Improved code generation infrastructure by doing simple register allocation and constant folding and propagation.
Optimized regular expression matching by avoiding to create intermediate string arrays and by flattening nested array representations of RegExp data.
Traverse a few stack frames when recording profiler samples to include partial call graphs in the profiling output.
Added support for using OProfile to profile generated code.
Added remote debugging support to the D8 developer shell.
Optimized creation of nested literals like JSON objects.
Fixed a bug in garbage collecting unused maps and turned it on by default (--collect-maps).
Added support for running tests under Valgrind.
git-svn-id: http://v8.googlecode.com/svn/trunk@1495 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/factory.cc b/src/factory.cc
index ec52520..ead40b4 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -153,14 +153,32 @@
Handle<Script> Factory::NewScript(Handle<String> source) {
+ // Generate id for this script.
+ int id;
+ if (Heap::last_script_id()->IsUndefined()) {
+ // Script ids start from one.
+ id = 1;
+ } else {
+ // Increment id, wrap when positive smi is exhausted.
+ id = Smi::cast(Heap::last_script_id())->value();
+ id++;
+ if (!Smi::IsValid(id)) {
+ id = 0;
+ }
+ }
+ Heap::SetLastScriptId(Smi::FromInt(id));
+
+ // Create and initialize script object.
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
script->set_source(*source);
script->set_name(Heap::undefined_value());
+ script->set_id(Heap::last_script_id());
script->set_line_offset(Smi::FromInt(0));
script->set_column_offset(Smi::FromInt(0));
script->set_type(Smi::FromInt(SCRIPT_TYPE_NORMAL));
script->set_wrapper(*Factory::NewProxy(0, TENURED));
script->set_line_ends(Heap::undefined_value());
+
return script;
}
@@ -277,6 +295,11 @@
}
+Handle<Object> Factory::NewNumberFromUint(uint32_t value) {
+ CALL_HEAP_FUNCTION(Heap::NumberFromUint32(value), Object);
+}
+
+
Handle<JSObject> Factory::NewNeanderObject() {
CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(Heap::neander_map()),
JSObject);
@@ -536,7 +559,9 @@
// Copy the descriptors from the array.
DescriptorWriter w(*result);
for (DescriptorReader r(*array); !r.eos(); r.advance()) {
- w.WriteFrom(&r);
+ if (!r.IsNullDescriptor()) {
+ w.WriteFrom(&r);
+ }
descriptor_count++;
}
@@ -826,12 +851,13 @@
}
-void Factory::SetRegExpData(Handle<JSRegExp> regexp,
- JSRegExp::Type type,
- Handle<String> source,
- JSRegExp::Flags flags,
- Handle<Object> data) {
- Handle<FixedArray> store = NewFixedArray(JSRegExp::kDataSize);
+void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp,
+ JSRegExp::Type type,
+ Handle<String> source,
+ JSRegExp::Flags flags,
+ Handle<Object> data) {
+ Handle<FixedArray> store = NewFixedArray(JSRegExp::kAtomDataSize);
+
store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
store->set(JSRegExp::kSourceIndex, *source);
store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
@@ -839,6 +865,25 @@
regexp->set_data(*store);
}
+void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
+ JSRegExp::Type type,
+ Handle<String> source,
+ JSRegExp::Flags flags,
+ int capture_count) {
+ Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize);
+
+ store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
+ store->set(JSRegExp::kSourceIndex, *source);
+ store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
+ store->set(JSRegExp::kIrregexpASCIICodeIndex, Heap::the_hole_value());
+ store->set(JSRegExp::kIrregexpUC16CodeIndex, Heap::the_hole_value());
+ store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0));
+ store->set(JSRegExp::kIrregexpCaptureCountIndex,
+ Smi::FromInt(capture_count));
+ regexp->set_data(*store);
+}
+
+
void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc,
Handle<JSObject> instance,