| 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-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 12 #include "src/compiler.h" | 12 #include "src/compiler.h" |
| 13 #include "src/debug.h" | 13 #include "src/debug.h" |
| 14 #include "src/full-codegen.h" | 14 #include "src/full-codegen.h" |
| 15 #include "src/ic/ic.h" |
| 15 #include "src/isolate-inl.h" | 16 #include "src/isolate-inl.h" |
| 16 #include "src/parser.h" | 17 #include "src/parser.h" |
| 17 #include "src/scopes.h" | 18 #include "src/scopes.h" |
| 18 | 19 |
| 19 namespace v8 { | 20 namespace v8 { |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| 22 #define __ ACCESS_MASM(masm_) | 23 #define __ ACCESS_MASM(masm_) |
| 23 | 24 |
| 24 | 25 |
| (...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 TypeFeedbackId ast_id) { | 2540 TypeFeedbackId ast_id) { |
| 2540 ic_total_count_++; | 2541 ic_total_count_++; |
| 2541 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2542 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
| 2542 } | 2543 } |
| 2543 | 2544 |
| 2544 | 2545 |
| 2545 // Code common for calls using the IC. | 2546 // Code common for calls using the IC. |
| 2546 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2547 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
| 2547 Expression* callee = expr->expression(); | 2548 Expression* callee = expr->expression(); |
| 2548 | 2549 |
| 2549 CallIC::CallType call_type = callee->IsVariableProxy() | 2550 CallICState::CallType call_type = |
| 2550 ? CallIC::FUNCTION | 2551 callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD; |
| 2551 : CallIC::METHOD; | |
| 2552 // Get the target function. | 2552 // Get the target function. |
| 2553 if (call_type == CallIC::FUNCTION) { | 2553 if (call_type == CallICState::FUNCTION) { |
| 2554 { StackValueContext context(this); | 2554 { StackValueContext context(this); |
| 2555 EmitVariableLoad(callee->AsVariableProxy()); | 2555 EmitVariableLoad(callee->AsVariableProxy()); |
| 2556 PrepareForBailout(callee, NO_REGISTERS); | 2556 PrepareForBailout(callee, NO_REGISTERS); |
| 2557 } | 2557 } |
| 2558 // Push undefined as receiver. This is patched in the method prologue if it | 2558 // Push undefined as receiver. This is patched in the method prologue if it |
| 2559 // is a sloppy mode method. | 2559 // is a sloppy mode method. |
| 2560 __ push(Immediate(isolate()->factory()->undefined_value())); | 2560 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 2561 } else { | 2561 } else { |
| 2562 // Load the function from the receiver. | 2562 // Load the function from the receiver. |
| 2563 DCHECK(callee->IsProperty()); | 2563 DCHECK(callee->IsProperty()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2585 DCHECK(callee->IsProperty()); | 2585 DCHECK(callee->IsProperty()); |
| 2586 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 2586 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 2587 __ mov(LoadDescriptor::NameRegister(), eax); | 2587 __ mov(LoadDescriptor::NameRegister(), eax); |
| 2588 EmitKeyedPropertyLoad(callee->AsProperty()); | 2588 EmitKeyedPropertyLoad(callee->AsProperty()); |
| 2589 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2589 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
| 2590 | 2590 |
| 2591 // Push the target function under the receiver. | 2591 // Push the target function under the receiver. |
| 2592 __ push(Operand(esp, 0)); | 2592 __ push(Operand(esp, 0)); |
| 2593 __ mov(Operand(esp, kPointerSize), eax); | 2593 __ mov(Operand(esp, kPointerSize), eax); |
| 2594 | 2594 |
| 2595 EmitCall(expr, CallIC::METHOD); | 2595 EmitCall(expr, CallICState::METHOD); |
| 2596 } | 2596 } |
| 2597 | 2597 |
| 2598 | 2598 |
| 2599 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { | 2599 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 2600 // Load the arguments. | 2600 // Load the arguments. |
| 2601 ZoneList<Expression*>* args = expr->arguments(); | 2601 ZoneList<Expression*>* args = expr->arguments(); |
| 2602 int arg_count = args->length(); | 2602 int arg_count = args->length(); |
| 2603 { PreservePositionScope scope(masm()->positions_recorder()); | 2603 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2604 for (int i = 0; i < arg_count; i++) { | 2604 for (int i = 0; i < arg_count; i++) { |
| 2605 VisitForStackValue(args->at(i)); | 2605 VisitForStackValue(args->at(i)); |
| 2606 } | 2606 } |
| 2607 } | 2607 } |
| 2608 | 2608 |
| 2609 // Record source position of the IC call. | 2609 // Record source position of the IC call. |
| (...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4823 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4823 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4824 Assembler::target_address_at(call_target_address, | 4824 Assembler::target_address_at(call_target_address, |
| 4825 unoptimized_code)); | 4825 unoptimized_code)); |
| 4826 return OSR_AFTER_STACK_CHECK; | 4826 return OSR_AFTER_STACK_CHECK; |
| 4827 } | 4827 } |
| 4828 | 4828 |
| 4829 | 4829 |
| 4830 } } // namespace v8::internal | 4830 } } // namespace v8::internal |
| 4831 | 4831 |
| 4832 #endif // V8_TARGET_ARCH_IA32 | 4832 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |