Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 SetFunctionPosition(function()); | 122 SetFunctionPosition(function()); |
| 123 Comment cmnt(masm_, "[ function compiled by full code generator"); | 123 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 124 | 124 |
| 125 #ifdef DEBUG | 125 #ifdef DEBUG |
| 126 if (strlen(FLAG_stop_at) > 0 && | 126 if (strlen(FLAG_stop_at) > 0 && |
| 127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 127 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
| 128 __ int3(); | 128 __ int3(); |
| 129 } | 129 } |
| 130 #endif | 130 #endif |
| 131 | 131 |
| 132 // Primitive functions are unlikely to be picked up by the stack-walking | |
| 133 // profiler, so they trigger their own optimization when they're called | |
| 134 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | |
| 135 if (FLAG_crankshaft && | |
|
fschneider
2011/12/13 11:53:01
If a function has optimization disabled via Disabl
Jakob Kummerow
2011/12/14 08:42:31
Done.
| |
| 136 info->function()->is_primitive() && | |
|
fschneider
2011/12/12 11:31:21
What is a primitive function? I can't find the sou
Jakob Kummerow
2011/12/14 08:42:31
Basically a function that doesn't contain loops, c
| |
| 137 !Serializer::enabled()) { | |
| 138 if (FLAG_trace_opt) { | |
| 139 PrintF("[adding self-optimization header to %s]\n", | |
| 140 *info->function()->debug_name()->ToCString()); | |
| 141 } | |
| 142 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( | |
| 143 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); | |
| 144 JSGlobalPropertyCell* cell; | |
| 145 if (maybe_cell->To(&cell)) { | |
| 146 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell))); | |
| 147 __ sub(FieldOperand(eax, JSGlobalPropertyCell::kValueOffset), | |
| 148 Immediate(Smi::FromInt(1))); | |
| 149 Handle<Code> compile_stub( | |
| 150 isolate()->builtins()->builtin(Builtins::kLazyRecompile)); | |
| 151 __ j(zero, compile_stub); | |
| 152 } | |
| 153 } | |
| 154 | |
| 132 // Strict mode functions and builtins need to replace the receiver | 155 // Strict mode functions and builtins need to replace the receiver |
| 133 // with undefined when called as functions (without an explicit | 156 // with undefined when called as functions (without an explicit |
| 134 // receiver object). ecx is zero for method calls and non-zero for | 157 // receiver object). ecx is zero for method calls and non-zero for |
| 135 // function calls. | 158 // function calls. |
| 136 if (!info->is_classic_mode() || info->is_native()) { | 159 if (!info->is_classic_mode() || info->is_native()) { |
| 137 Label ok; | 160 Label ok; |
| 138 __ test(ecx, ecx); | 161 __ test(ecx, ecx); |
| 139 __ j(zero, &ok, Label::kNear); | 162 __ j(zero, &ok, Label::kNear); |
| 140 // +1 for return address. | 163 // +1 for return address. |
| 141 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 164 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
| (...skipping 4238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4380 *context_length = 0; | 4403 *context_length = 0; |
| 4381 return previous_; | 4404 return previous_; |
| 4382 } | 4405 } |
| 4383 | 4406 |
| 4384 | 4407 |
| 4385 #undef __ | 4408 #undef __ |
| 4386 | 4409 |
| 4387 } } // namespace v8::internal | 4410 } } // namespace v8::internal |
| 4388 | 4411 |
| 4389 #endif // V8_TARGET_ARCH_IA32 | 4412 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |