| 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" |
| (...skipping 4477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 DCHECK(expr->arguments()->length() == 0); | 4488 DCHECK(expr->arguments()->length() == 0); |
| 4489 ExternalReference debug_is_active = | 4489 ExternalReference debug_is_active = |
| 4490 ExternalReference::debug_is_active_address(isolate()); | 4490 ExternalReference::debug_is_active_address(isolate()); |
| 4491 __ movzx_b(eax, Operand::StaticVariable(debug_is_active)); | 4491 __ movzx_b(eax, Operand::StaticVariable(debug_is_active)); |
| 4492 __ SmiTag(eax); | 4492 __ SmiTag(eax); |
| 4493 context()->Plug(eax); | 4493 context()->Plug(eax); |
| 4494 } | 4494 } |
| 4495 | 4495 |
| 4496 | 4496 |
| 4497 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4497 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
| 4498 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); | |
| 4499 if (generator != nullptr) { | |
| 4500 Comment cmnt(masm_, "[ InlineRuntimeCall"); | |
| 4501 EmitInlineRuntimeCall(expr, generator); | |
| 4502 return; | |
| 4503 } | |
| 4504 | |
| 4505 Comment cmnt(masm_, "[ CallRuntime"); | |
| 4506 ZoneList<Expression*>* args = expr->arguments(); | 4498 ZoneList<Expression*>* args = expr->arguments(); |
| 4499 int arg_count = args->length(); |
| 4507 | 4500 |
| 4508 if (expr->is_jsruntime()) { | 4501 if (expr->is_jsruntime()) { |
| 4502 Comment cmnt(masm_, "[ CallRuntime"); |
| 4509 // Push the builtins object as receiver. | 4503 // Push the builtins object as receiver. |
| 4510 __ mov(eax, GlobalObjectOperand()); | 4504 __ mov(eax, GlobalObjectOperand()); |
| 4511 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); | 4505 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); |
| 4512 | 4506 |
| 4513 // Load the function from the receiver. | 4507 // Load the function from the receiver. |
| 4514 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); | 4508 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); |
| 4515 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); | 4509 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); |
| 4516 if (FLAG_vector_ics) { | 4510 if (FLAG_vector_ics) { |
| 4517 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4511 __ mov(VectorLoadICDescriptor::SlotRegister(), |
| 4518 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4512 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
| 4519 CallLoadIC(NOT_CONTEXTUAL); | 4513 CallLoadIC(NOT_CONTEXTUAL); |
| 4520 } else { | 4514 } else { |
| 4521 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4515 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4522 } | 4516 } |
| 4523 | 4517 |
| 4524 // Push the target function under the receiver. | 4518 // Push the target function under the receiver. |
| 4525 __ push(Operand(esp, 0)); | 4519 __ push(Operand(esp, 0)); |
| 4526 __ mov(Operand(esp, kPointerSize), eax); | 4520 __ mov(Operand(esp, kPointerSize), eax); |
| 4527 | 4521 |
| 4528 // Code common for calls using the IC. | 4522 // Push the arguments ("left-to-right"). |
| 4529 ZoneList<Expression*>* args = expr->arguments(); | |
| 4530 int arg_count = args->length(); | |
| 4531 for (int i = 0; i < arg_count; i++) { | 4523 for (int i = 0; i < arg_count; i++) { |
| 4532 VisitForStackValue(args->at(i)); | 4524 VisitForStackValue(args->at(i)); |
| 4533 } | 4525 } |
| 4534 | 4526 |
| 4535 // Record source position of the IC call. | 4527 // Record source position of the IC call. |
| 4536 SetSourcePosition(expr->position()); | 4528 SetSourcePosition(expr->position()); |
| 4537 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4529 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| 4538 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 4530 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 4539 __ CallStub(&stub); | 4531 __ CallStub(&stub); |
| 4540 // Restore context register. | 4532 // Restore context register. |
| 4541 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4533 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4542 context()->DropAndPlug(1, eax); | 4534 context()->DropAndPlug(1, eax); |
| 4543 | 4535 |
| 4544 } else { | 4536 } else { |
| 4545 // Push the arguments ("left-to-right"). | 4537 const Runtime::Function* function = expr->function(); |
| 4546 int arg_count = args->length(); | 4538 switch (function->function_id) { |
| 4547 for (int i = 0; i < arg_count; i++) { | 4539 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 4548 VisitForStackValue(args->at(i)); | 4540 case Runtime::kInline##Name: { \ |
| 4541 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 4542 return Emit##Name(expr); \ |
| 4543 } |
| 4544 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 4545 #undef CALL_INTRINSIC_GENERATOR |
| 4546 default: { |
| 4547 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 4548 // Push the arguments ("left-to-right"). |
| 4549 for (int i = 0; i < arg_count; i++) { |
| 4550 VisitForStackValue(args->at(i)); |
| 4551 } |
| 4552 |
| 4553 // Call the C runtime function. |
| 4554 __ CallRuntime(expr->function(), arg_count); |
| 4555 context()->Plug(eax); |
| 4556 } |
| 4549 } | 4557 } |
| 4550 | |
| 4551 // Call the C runtime function. | |
| 4552 __ CallRuntime(expr->function(), arg_count); | |
| 4553 | |
| 4554 context()->Plug(eax); | |
| 4555 } | 4558 } |
| 4556 } | 4559 } |
| 4557 | 4560 |
| 4558 | 4561 |
| 4559 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4562 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
| 4560 switch (expr->op()) { | 4563 switch (expr->op()) { |
| 4561 case Token::DELETE: { | 4564 case Token::DELETE: { |
| 4562 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4565 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
| 4563 Property* property = expr->expression()->AsProperty(); | 4566 Property* property = expr->expression()->AsProperty(); |
| 4564 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4567 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5350 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5353 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5351 Assembler::target_address_at(call_target_address, | 5354 Assembler::target_address_at(call_target_address, |
| 5352 unoptimized_code)); | 5355 unoptimized_code)); |
| 5353 return OSR_AFTER_STACK_CHECK; | 5356 return OSR_AFTER_STACK_CHECK; |
| 5354 } | 5357 } |
| 5355 | 5358 |
| 5356 | 5359 |
| 5357 } } // namespace v8::internal | 5360 } } // namespace v8::internal |
| 5358 | 5361 |
| 5359 #endif // V8_TARGET_ARCH_X87 | 5362 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |