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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 TypeFeedbackId ast_id) { | 2534 TypeFeedbackId ast_id) { |
2534 ic_total_count_++; | 2535 ic_total_count_++; |
2535 __ call(code, RelocInfo::CODE_TARGET, ast_id); | 2536 __ call(code, RelocInfo::CODE_TARGET, ast_id); |
2536 } | 2537 } |
2537 | 2538 |
2538 | 2539 |
2539 // Code common for calls using the IC. | 2540 // Code common for calls using the IC. |
2540 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { | 2541 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
2541 Expression* callee = expr->expression(); | 2542 Expression* callee = expr->expression(); |
2542 | 2543 |
2543 CallIC::CallType call_type = callee->IsVariableProxy() | 2544 CallICState::CallType call_type = |
2544 ? CallIC::FUNCTION | 2545 callee->IsVariableProxy() ? CallICState::FUNCTION : CallICState::METHOD; |
2545 : CallIC::METHOD; | |
2546 // Get the target function. | 2546 // Get the target function. |
2547 if (call_type == CallIC::FUNCTION) { | 2547 if (call_type == CallICState::FUNCTION) { |
2548 { StackValueContext context(this); | 2548 { StackValueContext context(this); |
2549 EmitVariableLoad(callee->AsVariableProxy()); | 2549 EmitVariableLoad(callee->AsVariableProxy()); |
2550 PrepareForBailout(callee, NO_REGISTERS); | 2550 PrepareForBailout(callee, NO_REGISTERS); |
2551 } | 2551 } |
2552 // Push undefined as receiver. This is patched in the method prologue if it | 2552 // Push undefined as receiver. This is patched in the method prologue if it |
2553 // is a sloppy mode method. | 2553 // is a sloppy mode method. |
2554 __ push(Immediate(isolate()->factory()->undefined_value())); | 2554 __ push(Immediate(isolate()->factory()->undefined_value())); |
2555 } else { | 2555 } else { |
2556 // Load the function from the receiver. | 2556 // Load the function from the receiver. |
2557 DCHECK(callee->IsProperty()); | 2557 DCHECK(callee->IsProperty()); |
(...skipping 21 matching lines...) Expand all Loading... |
2579 DCHECK(callee->IsProperty()); | 2579 DCHECK(callee->IsProperty()); |
2580 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 2580 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
2581 __ mov(LoadDescriptor::NameRegister(), eax); | 2581 __ mov(LoadDescriptor::NameRegister(), eax); |
2582 EmitKeyedPropertyLoad(callee->AsProperty()); | 2582 EmitKeyedPropertyLoad(callee->AsProperty()); |
2583 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); | 2583 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); |
2584 | 2584 |
2585 // Push the target function under the receiver. | 2585 // Push the target function under the receiver. |
2586 __ push(Operand(esp, 0)); | 2586 __ push(Operand(esp, 0)); |
2587 __ mov(Operand(esp, kPointerSize), eax); | 2587 __ mov(Operand(esp, kPointerSize), eax); |
2588 | 2588 |
2589 EmitCall(expr, CallIC::METHOD); | 2589 EmitCall(expr, CallICState::METHOD); |
2590 } | 2590 } |
2591 | 2591 |
2592 | 2592 |
2593 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { | 2593 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
2594 // Load the arguments. | 2594 // Load the arguments. |
2595 ZoneList<Expression*>* args = expr->arguments(); | 2595 ZoneList<Expression*>* args = expr->arguments(); |
2596 int arg_count = args->length(); | 2596 int arg_count = args->length(); |
2597 { PreservePositionScope scope(masm()->positions_recorder()); | 2597 { PreservePositionScope scope(masm()->positions_recorder()); |
2598 for (int i = 0; i < arg_count; i++) { | 2598 for (int i = 0; i < arg_count; i++) { |
2599 VisitForStackValue(args->at(i)); | 2599 VisitForStackValue(args->at(i)); |
2600 } | 2600 } |
2601 } | 2601 } |
2602 | 2602 |
2603 // Record source position of the IC call. | 2603 // Record source position of the IC call. |
(...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4816 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4816 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4817 Assembler::target_address_at(call_target_address, | 4817 Assembler::target_address_at(call_target_address, |
4818 unoptimized_code)); | 4818 unoptimized_code)); |
4819 return OSR_AFTER_STACK_CHECK; | 4819 return OSR_AFTER_STACK_CHECK; |
4820 } | 4820 } |
4821 | 4821 |
4822 | 4822 |
4823 } } // namespace v8::internal | 4823 } } // namespace v8::internal |
4824 | 4824 |
4825 #endif // V8_TARGET_ARCH_X87 | 4825 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |