Revision: 3505
Author: [email protected]
Date: Mon Dec 21 02:24:11 2009
Log: The number of heap slots stored in a scope includes the
fixed contexts slots. Take this into account when using
the new, fast context creation path to avoid allocating
too many slots (wasteful).
Review URL: http://codereview.chromium.org/501148
http://code.google.com/p/v8/source/detail?r=3505
Modified:
/branches/bleeding_edge/src/contexts.cc
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/ia32/codegen-ia32.cc
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
=======================================
--- /branches/bleeding_edge/src/contexts.cc Mon Jun 22 01:09:57 2009
+++ /branches/bleeding_edge/src/contexts.cc Mon Dec 21 02:24:11 2009
@@ -52,11 +52,14 @@
if (global()->IsGlobalObject()) {
return global()->global_context();
}
+
// During bootstrapping, the global object might not be set and we
// have to search the context chain to find the global context.
+ ASSERT(Bootstrapper::IsActive());
Context* current = this;
while (!current->IsGlobalContext()) {
- current =
Context::cast(JSFunction::cast(current->closure())->context());
+ JSFunction* closure = JSFunction::cast(current->closure());
+ current = Context::cast(closure->context());
}
return current;
}
=======================================
--- /branches/bleeding_edge/src/execution.cc Tue Dec 15 01:17:15 2009
+++ /branches/bleeding_edge/src/execution.cc Mon Dec 21 02:24:11 2009
@@ -78,6 +78,10 @@
Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver);
receiver = Handle<JSObject>(global->global_receiver());
}
+
+ // Make sure that the global object of the context we're about to
+ // make the current one is indeed a global object.
+ ASSERT(func->context()->global()->IsGlobalObject());
{
// Save and restore context around invocation and block the
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Mon Dec 21 00:32:20
2009
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Mon Dec 21 02:24:11
2009
@@ -174,7 +174,7 @@
function_return_is_shadowed_ = false;
// Allocate the local context if needed.
- int heap_slots = scope_->num_heap_slots();
+ int heap_slots = scope_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
if (heap_slots > 0) {
Comment cmnt(masm_, "[ allocate local context");
// Allocate local context.
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Sun Dec 20
00:40:13 2009
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon Dec 21
02:24:11 2009
@@ -1369,7 +1369,6 @@
JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize);
mov(edi, FieldOperand(edx, builtins_offset));
-
return Builtins::GetCode(id, resolved);
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev