| Index: src/ia32/codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/codegen-ia32.cc (revision 2034)
|
| +++ src/ia32/codegen-ia32.cc (working copy)
|
| @@ -1652,12 +1652,14 @@
|
|
|
| class CallFunctionStub: public CodeStub {
|
| public:
|
| - explicit CallFunctionStub(int argc) : argc_(argc) { }
|
| + CallFunctionStub(int argc, InlineCacheInLoop in_loop)
|
| + : argc_(argc), in_loop_(in_loop) { }
|
|
|
| void Generate(MacroAssembler* masm);
|
|
|
| private:
|
| int argc_;
|
| + InlineCacheInLoop in_loop_;
|
|
|
| #ifdef DEBUG
|
| void Print() { PrintF("CallFunctionStub (args %d)\n", argc_); }
|
| @@ -1665,6 +1667,7 @@
|
|
|
| Major MajorKey() { return CallFunction; }
|
| int MinorKey() { return argc_; }
|
| + InlineCacheInLoop InLoop() { return in_loop_; }
|
| };
|
|
|
|
|
| @@ -1682,7 +1685,8 @@
|
| CodeForSourcePosition(position);
|
|
|
| // Use the shared code stub to call the function.
|
| - CallFunctionStub call_function(arg_count);
|
| + InlineCacheInLoop in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
|
| + CallFunctionStub call_function(arg_count, in_loop);
|
| Result answer = frame_->CallStub(&call_function, arg_count + 1);
|
| // Restore context and replace function on the stack with the
|
| // result of the stub invocation.
|
| @@ -4216,7 +4220,8 @@
|
|
|
| // Call the function.
|
| CodeForSourcePosition(node->position());
|
| - CallFunctionStub call_function(arg_count);
|
| + InlineCacheInLoop in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP;
|
| + CallFunctionStub call_function(arg_count, in_loop);
|
| result = frame_->CallStub(&call_function, arg_count + 1);
|
|
|
| // Restore the context and overwrite the function on the stack with
|
| @@ -4580,9 +4585,10 @@
|
| }
|
|
|
| if (function == NULL) {
|
| - // Call the JS runtime function. Pass 0 as the loop nesting depth
|
| - // because we do not handle runtime calls specially in loops.
|
| - Result answer = frame_->CallCallIC(RelocInfo::CODE_TARGET, arg_count, 0);
|
| + // Call the JS runtime function.
|
| + Result answer = frame_->CallCallIC(RelocInfo::CODE_TARGET,
|
| + arg_count,
|
| + loop_nesting_);
|
| frame_->RestoreContextRegister();
|
| frame_->SetElementAt(0, &answer);
|
| } else {
|
| @@ -5394,9 +5400,13 @@
|
| bool is_global = var != NULL;
|
| ASSERT(!is_global || var->is_global());
|
|
|
| - if (is_global || cgen_->scope()->is_global_scope()) {
|
| - // Do not inline the inobject property case for loads from the
|
| - // global object or loads in toplevel code.
|
| + // Do not inline the inobject property case for loads from the global
|
| + // object. Also do not inline for unoptimized code. This saves time
|
| + // in the code generator. Unoptimized code is toplevel code or code
|
| + // that is not in a loop.
|
| + if (is_global ||
|
| + cgen_->scope()->is_global_scope() ||
|
| + cgen_->loop_nesting() == 0) {
|
| Comment cmnt(masm, "[ Load from named Property");
|
| cgen_->frame()->Push(GetName());
|
|
|
|
|