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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1270 context()->Plug(eax); | 1270 context()->Plug(eax); |
1271 } | 1271 } |
1272 | 1272 |
1273 | 1273 |
1274 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { | 1274 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { |
1275 Comment cmnt(masm_, "[ VariableProxy"); | 1275 Comment cmnt(masm_, "[ VariableProxy"); |
1276 EmitVariableLoad(expr); | 1276 EmitVariableLoad(expr); |
1277 } | 1277 } |
1278 | 1278 |
1279 | 1279 |
1280 void FullCodeGenerator::VisitSuperReference(SuperReference* expr) { | |
1281 Comment cnmt(masm_, "[ SuperReference "); | |
1282 | |
1283 __ mov(LoadConvention::ReceiverRegister(), | |
1284 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
1285 | |
1286 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | |
1287 __ mov(LoadConvention::NameRegister(), home_object_symbol); | |
1288 | |
1289 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); | |
1290 | |
1291 __ cmp(eax, isolate()->factory()->undefined_value()); | |
1292 Label done; | |
1293 __ j(not_equal, &done); | |
1294 __ push(Immediate(isolate()->factory()->empty_string())); | |
1295 __ CallRuntime(Runtime::kThrowReferenceError, 1); | |
1296 __ bind(&done); | |
1297 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | |
1298 __ mov(eax, FieldOperand(eax, Map::kPrototypeOffset)); | |
Dmitry Lomov (no reviews)
2014/09/15 13:18:25
As discussed offline, this skips the access check
Dmitry Lomov (no reviews)
2014/09/16 13:15:55
Done.
| |
1299 context()->Plug(eax); | |
1300 } | |
1301 | |
1302 | |
1280 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1303 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1281 TypeofState typeof_state, | 1304 TypeofState typeof_state, |
1282 Label* slow) { | 1305 Label* slow) { |
1283 Register context = esi; | 1306 Register context = esi; |
1284 Register temp = edx; | 1307 Register temp = edx; |
1285 | 1308 |
1286 Scope* s = scope(); | 1309 Scope* s = scope(); |
1287 while (s != NULL) { | 1310 while (s != NULL) { |
1288 if (s->num_heap_slots() > 0) { | 1311 if (s->num_heap_slots() > 0) { |
1289 if (s->calls_sloppy_eval()) { | 1312 if (s->calls_sloppy_eval()) { |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2212 // root set. | 2235 // root set. |
2213 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, | 2236 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, |
2214 ecx, edx, kDontSaveFPRegs); | 2237 ecx, edx, kDontSaveFPRegs); |
2215 } | 2238 } |
2216 | 2239 |
2217 | 2240 |
2218 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2241 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2219 SetSourcePosition(prop->position()); | 2242 SetSourcePosition(prop->position()); |
2220 Literal* key = prop->key()->AsLiteral(); | 2243 Literal* key = prop->key()->AsLiteral(); |
2221 DCHECK(!key->value()->IsSmi()); | 2244 DCHECK(!key->value()->IsSmi()); |
2245 | |
2246 if (prop->IsSuperAccess()) { | |
2247 __ push(LoadConvention::ReceiverRegister()); | |
2248 | |
2249 SuperReference* super_ref = prop->obj()->AsSuperReference(); | |
2250 VisitForStackValue(super_ref->this_var()); | |
2251 __ push(Immediate(key->value())); | |
2252 __ CallRuntime(Runtime::kLoadFromSuper, 3); | |
2253 return; | |
2254 } | |
2255 | |
2222 __ mov(LoadConvention::NameRegister(), Immediate(key->value())); | 2256 __ mov(LoadConvention::NameRegister(), Immediate(key->value())); |
2223 if (FLAG_vector_ics) { | 2257 if (FLAG_vector_ics) { |
2224 __ mov(VectorLoadConvention::SlotRegister(), | 2258 __ mov(VectorLoadConvention::SlotRegister(), |
2225 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); | 2259 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); |
2226 CallLoadIC(NOT_CONTEXTUAL); | 2260 CallLoadIC(NOT_CONTEXTUAL); |
2227 } else { | 2261 } else { |
2228 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); | 2262 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); |
2229 } | 2263 } |
2230 } | 2264 } |
2231 | 2265 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2554 : CallIC::METHOD; | 2588 : CallIC::METHOD; |
2555 // Get the target function. | 2589 // Get the target function. |
2556 if (call_type == CallIC::FUNCTION) { | 2590 if (call_type == CallIC::FUNCTION) { |
2557 { StackValueContext context(this); | 2591 { StackValueContext context(this); |
2558 EmitVariableLoad(callee->AsVariableProxy()); | 2592 EmitVariableLoad(callee->AsVariableProxy()); |
2559 PrepareForBailout(callee, NO_REGISTERS); | 2593 PrepareForBailout(callee, NO_REGISTERS); |
2560 } | 2594 } |
2561 // Push undefined as receiver. This is patched in the method prologue if it | 2595 // Push undefined as receiver. This is patched in the method prologue if it |
2562 // is a sloppy mode method. | 2596 // is a sloppy mode method. |
2563 __ push(Immediate(isolate()->factory()->undefined_value())); | 2597 __ push(Immediate(isolate()->factory()->undefined_value())); |
2598 } else if (callee->AsProperty()->IsSuperAccess()) { | |
2599 Property* prop = callee->AsProperty(); | |
2600 SetSourcePosition(prop->position()); | |
2601 Literal* key = prop->key()->AsLiteral(); | |
2602 DCHECK(!key->value()->IsSmi()); | |
2603 // Load the function from the receiver. | |
2604 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); | |
2605 VisitForAccumulatorValue(super_ref->this_var()); | |
2606 __ push(eax); | |
2607 __ push(Operand(esp, kPointerSize)); | |
2608 __ push(eax); | |
2609 __ push(Immediate(key->value())); | |
2610 __ CallRuntime(Runtime::kLoadFromSuper, 3); | |
2611 __ mov(Operand(esp, kPointerSize), eax); | |
2564 } else { | 2612 } else { |
2565 // Load the function from the receiver. | 2613 // Load the function from the receiver. |
2566 DCHECK(callee->IsProperty()); | 2614 DCHECK(callee->IsProperty()); |
2567 __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); | 2615 __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); |
2568 EmitNamedPropertyLoad(callee->AsProperty()); | 2616 EmitNamedPropertyLoad(callee->AsProperty()); |
2569 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2617 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2570 // Push the target function under the receiver. | 2618 // Push the target function under the receiver. |
2571 __ push(Operand(esp, 0)); | 2619 __ push(Operand(esp, 0)); |
2572 __ mov(Operand(esp, kPointerSize), eax); | 2620 __ mov(Operand(esp, kPointerSize), eax); |
2573 } | 2621 } |
(...skipping 11 matching lines...) Expand all Loading... | |
2585 Expression* callee = expr->expression(); | 2633 Expression* callee = expr->expression(); |
2586 | 2634 |
2587 // Load the function from the receiver. | 2635 // Load the function from the receiver. |
2588 DCHECK(callee->IsProperty()); | 2636 DCHECK(callee->IsProperty()); |
2589 __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); | 2637 __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); |
2590 __ mov(LoadConvention::NameRegister(), eax); | 2638 __ mov(LoadConvention::NameRegister(), eax); |
2591 EmitKeyedPropertyLoad(callee->AsProperty()); | 2639 EmitKeyedPropertyLoad(callee->AsProperty()); |
2592 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2640 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2593 | 2641 |
2594 // Push the target function under the receiver. | 2642 // Push the target function under the receiver. |
2595 __ push(Operand(esp, 0)); | 2643 if (callee->AsProperty()->IsSuperAccess()) { |
2596 __ mov(Operand(esp, kPointerSize), eax); | 2644 __ mov(Operand(esp, 0), eax); |
2645 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); | |
2646 VisitForStackValue(super_ref->this_var()); | |
2647 } else { | |
2648 __ push(Operand(esp, 0)); | |
2649 __ mov(Operand(esp, kPointerSize), eax); | |
2650 } | |
2597 | 2651 |
2598 EmitCall(expr, CallIC::METHOD); | 2652 EmitCall(expr, CallIC::METHOD); |
2599 } | 2653 } |
2600 | 2654 |
2601 | 2655 |
2602 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { | 2656 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { |
2603 // Load the arguments. | 2657 // Load the arguments. |
2604 ZoneList<Expression*>* args = expr->arguments(); | 2658 ZoneList<Expression*>* args = expr->arguments(); |
2605 int arg_count = args->length(); | 2659 int arg_count = args->length(); |
2606 { PreservePositionScope scope(masm()->positions_recorder()); | 2660 { PreservePositionScope scope(masm()->positions_recorder()); |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4826 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4880 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4827 Assembler::target_address_at(call_target_address, | 4881 Assembler::target_address_at(call_target_address, |
4828 unoptimized_code)); | 4882 unoptimized_code)); |
4829 return OSR_AFTER_STACK_CHECK; | 4883 return OSR_AFTER_STACK_CHECK; |
4830 } | 4884 } |
4831 | 4885 |
4832 | 4886 |
4833 } } // namespace v8::internal | 4887 } } // namespace v8::internal |
4834 | 4888 |
4835 #endif // V8_TARGET_ARCH_IA32 | 4889 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |