Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1271 context()->Plug(eax); | 1271 context()->Plug(eax); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 | 1274 |
| 1275 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1275 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
| 1276 Comment cmnt(masm_, "[ VariableProxy"); | 1276 Comment cmnt(masm_, "[ VariableProxy"); |
| 1277 EmitVariableLoad(expr); | 1277 EmitVariableLoad(expr); |
| 1278 } | 1278 } |
| 1279 | 1279 |
| 1280 | 1280 |
| 1281 void FullCodeGenerator::VisitSuperReference(SuperReference* expr) { | |
| 1282 Comment cnmt(masm_, "[ SuperReference "); | |
| 1283 | |
| 1284 const Register r = eax; | |
| 1285 Label super_lookup_failure; | |
| 1286 __ mov(r, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
| 1287 __ mov(r, FieldOperand(r, JSFunction::kHomeObjectOffset)); | |
|
adamk
2014/08/07 20:38:04
You mentioned that you're thinking of re-implement
| |
| 1288 __ cmp(r, isolate()->factory()->undefined_value()); | |
| 1289 __ j(equal, &super_lookup_failure); | |
| 1290 __ mov(r, FieldOperand(r, HeapObject::kMapOffset)); | |
| 1291 __ mov(r, FieldOperand(r, Map::kPrototypeOffset)); | |
| 1292 Label done; | |
| 1293 __ jmp(&done); | |
| 1294 __ bind(&super_lookup_failure); | |
| 1295 __ push(Immediate(isolate()->factory()->empty_string())); | |
| 1296 __ CallRuntime(Runtime::kThrowReferenceError, 1); | |
| 1297 __ bind(&done); | |
| 1298 context()->Plug(eax); | |
| 1299 } | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1281 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1303 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
| 1282 TypeofState typeof_state, | 1304 TypeofState typeof_state, |
| 1283 Label* slow) { | 1305 Label* slow) { |
| 1284 Register context = esi; | 1306 Register context = esi; |
| 1285 Register temp = edx; | 1307 Register temp = edx; |
| 1286 | 1308 |
| 1287 Scope* s = scope(); | 1309 Scope* s = scope(); |
| 1288 while (s != NULL) { | 1310 while (s != NULL) { |
| 1289 if (s->num_heap_slots() > 0) { | 1311 if (s->num_heap_slots() > 0) { |
| 1290 if (s->calls_sloppy_eval()) { | 1312 if (s->calls_sloppy_eval()) { |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2213 // root set. | 2235 // root set. |
| 2214 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, | 2236 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, |
| 2215 ecx, edx, kDontSaveFPRegs); | 2237 ecx, edx, kDontSaveFPRegs); |
| 2216 } | 2238 } |
| 2217 | 2239 |
| 2218 | 2240 |
| 2219 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2241 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2220 SetSourcePosition(prop->position()); | 2242 SetSourcePosition(prop->position()); |
| 2221 Literal* key = prop->key()->AsLiteral(); | 2243 Literal* key = prop->key()->AsLiteral(); |
| 2222 DCHECK(!key->value()->IsSmi()); | 2244 DCHECK(!key->value()->IsSmi()); |
| 2245 | |
| 2223 __ mov(LoadIC::NameRegister(), Immediate(key->value())); | 2246 __ mov(LoadIC::NameRegister(), Immediate(key->value())); |
| 2224 if (FLAG_vector_ics) { | 2247 if (FLAG_vector_ics) { |
| 2225 __ mov(LoadIC::SlotRegister(), | 2248 __ mov(LoadIC::SlotRegister(), |
| 2226 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2249 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
| 2227 CallLoadIC(NOT_CONTEXTUAL); | 2250 CallLoadIC(NOT_CONTEXTUAL); |
| 2228 } else { | 2251 } else { |
| 2229 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2252 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
| 2230 } | 2253 } |
| 2231 } | 2254 } |
| 2232 | 2255 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2561 // Push undefined as receiver. This is patched in the method prologue if it | 2584 // Push undefined as receiver. This is patched in the method prologue if it |
| 2562 // is a sloppy mode method. | 2585 // is a sloppy mode method. |
| 2563 __ push(Immediate(isolate()->factory()->undefined_value())); | 2586 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 2564 } else { | 2587 } else { |
| 2565 // Load the function from the receiver. | 2588 // Load the function from the receiver. |
| 2566 DCHECK(callee->IsProperty()); | 2589 DCHECK(callee->IsProperty()); |
| 2567 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); | 2590 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); |
| 2568 EmitNamedPropertyLoad(callee->AsProperty()); | 2591 EmitNamedPropertyLoad(callee->AsProperty()); |
| 2569 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2592 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
| 2570 // Push the target function under the receiver. | 2593 // Push the target function under the receiver. |
| 2571 __ push(Operand(esp, 0)); | 2594 if (callee->AsProperty()->IsSuperAccess()) { |
| 2572 __ mov(Operand(esp, kPointerSize), eax); | 2595 __ mov(Operand(esp, 0), eax); |
| 2596 SuperReference* super_ref = | |
| 2597 callee->AsProperty()->obj()->AsSuperReference(); | |
| 2598 VisitForStackValue(super_ref->this_var()); | |
| 2599 } else { | |
| 2600 __ push(Operand(esp, 0)); | |
| 2601 __ mov(Operand(esp, kPointerSize), eax); | |
| 2602 } | |
| 2573 } | 2603 } |
| 2574 | 2604 |
| 2575 EmitCall(expr, call_type); | 2605 EmitCall(expr, call_type); |
| 2576 } | 2606 } |
| 2577 | 2607 |
| 2578 | 2608 |
| 2579 // Code common for calls using the IC. | 2609 // Code common for calls using the IC. |
| 2580 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, | 2610 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
| 2581 Expression* key) { | 2611 Expression* key) { |
| 2582 // Load the key. | 2612 // Load the key. |
| 2583 VisitForAccumulatorValue(key); | 2613 VisitForAccumulatorValue(key); |
| 2584 | 2614 |
| 2585 Expression* callee = expr->expression(); | 2615 Expression* callee = expr->expression(); |
| 2586 | 2616 |
| 2587 // Load the function from the receiver. | 2617 // Load the function from the receiver. |
| 2588 DCHECK(callee->IsProperty()); | 2618 DCHECK(callee->IsProperty()); |
| 2589 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); | 2619 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); |
| 2590 __ mov(LoadIC::NameRegister(), eax); | 2620 __ mov(LoadIC::NameRegister(), eax); |
| 2591 EmitKeyedPropertyLoad(callee->AsProperty()); | 2621 EmitKeyedPropertyLoad(callee->AsProperty()); |
| 2592 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2622 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
| 2593 | 2623 |
| 2594 // Push the target function under the receiver. | 2624 // Push the target function under the receiver. |
| 2595 __ push(Operand(esp, 0)); | 2625 if (callee->AsProperty()->IsSuperAccess()) { |
| 2596 __ mov(Operand(esp, kPointerSize), eax); | 2626 __ mov(Operand(esp, 0), eax); |
| 2627 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); | |
| 2628 VisitForStackValue(super_ref->this_var()); | |
| 2629 } else { | |
| 2630 __ push(Operand(esp, 0)); | |
| 2631 __ mov(Operand(esp, kPointerSize), eax); | |
| 2632 } | |
| 2597 | 2633 |
| 2598 EmitCall(expr, CallIC::METHOD); | 2634 EmitCall(expr, CallIC::METHOD); |
| 2599 } | 2635 } |
| 2600 | 2636 |
| 2601 | 2637 |
| 2602 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { | 2638 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { |
| 2603 // Load the arguments. | 2639 // Load the arguments. |
| 2604 ZoneList<Expression*>* args = expr->arguments(); | 2640 ZoneList<Expression*>* args = expr->arguments(); |
| 2605 int arg_count = args->length(); | 2641 int arg_count = args->length(); |
| 2606 { PreservePositionScope scope(masm()->positions_recorder()); | 2642 { PreservePositionScope scope(masm()->positions_recorder()); |
| (...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4825 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4861 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4826 Assembler::target_address_at(call_target_address, | 4862 Assembler::target_address_at(call_target_address, |
| 4827 unoptimized_code)); | 4863 unoptimized_code)); |
| 4828 return OSR_AFTER_STACK_CHECK; | 4864 return OSR_AFTER_STACK_CHECK; |
| 4829 } | 4865 } |
| 4830 | 4866 |
| 4831 | 4867 |
| 4832 } } // namespace v8::internal | 4868 } } // namespace v8::internal |
| 4833 | 4869 |
| 4834 #endif // V8_TARGET_ARCH_IA32 | 4870 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |