OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 SetFunctionPosition(function()); | 132 SetFunctionPosition(function()); |
133 Comment cmnt(masm_, "[ function compiled by full code generator"); | 133 Comment cmnt(masm_, "[ function compiled by full code generator"); |
134 | 134 |
135 #ifdef DEBUG | 135 #ifdef DEBUG |
136 if (strlen(FLAG_stop_at) > 0 && | 136 if (strlen(FLAG_stop_at) > 0 && |
137 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 137 info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
138 __ stop("stop-at"); | 138 __ stop("stop-at"); |
139 } | 139 } |
140 #endif | 140 #endif |
141 | 141 |
142 // Primitive functions are unlikely to be picked up by the stack-walking | |
143 // profiler, so they trigger their own optimization when they're called | |
144 // for the SharedFunctionInfo::kCallsUntilPrimitiveOptimization-th time. | |
Erik Corry
2012/02/09 09:43:33
I think this comment should be moved into ShouldSe
Jakob Kummerow
2012/02/09 10:13:20
Done.
| |
145 if (info->ShouldSelfOptimize()) { | |
146 if (FLAG_trace_opt) { | |
Erik Corry
2012/02/09 09:43:33
I think this might be annoyingly verbose, but we c
Jakob Kummerow
2012/02/09 10:13:20
As discussed, let's leave it for now. We can alway
| |
147 PrintF("[adding self-optimization header to %s]\n", | |
148 *info->function()->debug_name()->ToCString()); | |
149 } | |
150 MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( | |
151 Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); | |
152 JSGlobalPropertyCell* cell; | |
153 if (maybe_cell->To(&cell)) { | |
154 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell))); | |
155 __ ldr(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | |
156 __ sub(r3, r3, Operand(Smi::FromInt(1)), SetCC); | |
157 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | |
158 Handle<Code> compile_stub( | |
159 isolate()->builtins()->builtin(Builtins::kLazyRecompile)); | |
160 __ Jump(compile_stub, RelocInfo::CODE_TARGET, eq); | |
161 } | |
162 } | |
163 | |
142 // Strict mode functions and builtins need to replace the receiver | 164 // Strict mode functions and builtins need to replace the receiver |
143 // with undefined when called as functions (without an explicit | 165 // with undefined when called as functions (without an explicit |
144 // receiver object). r5 is zero for method calls and non-zero for | 166 // receiver object). r5 is zero for method calls and non-zero for |
145 // function calls. | 167 // function calls. |
146 if (!info->is_classic_mode() || info->is_native()) { | 168 if (!info->is_classic_mode() || info->is_native()) { |
147 Label ok; | 169 Label ok; |
148 __ cmp(r5, Operand(0)); | 170 __ cmp(r5, Operand(0)); |
149 __ b(eq, &ok); | 171 __ b(eq, &ok); |
150 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 172 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
151 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 173 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
(...skipping 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4403 *context_length = 0; | 4425 *context_length = 0; |
4404 return previous_; | 4426 return previous_; |
4405 } | 4427 } |
4406 | 4428 |
4407 | 4429 |
4408 #undef __ | 4430 #undef __ |
4409 | 4431 |
4410 } } // namespace v8::internal | 4432 } } // namespace v8::internal |
4411 | 4433 |
4412 #endif // V8_TARGET_ARCH_ARM | 4434 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |