OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 4287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 ExternalReference debug_is_active = | 4298 ExternalReference debug_is_active = |
4299 ExternalReference::debug_is_active_address(isolate()); | 4299 ExternalReference::debug_is_active_address(isolate()); |
4300 __ Mov(x10, debug_is_active); | 4300 __ Mov(x10, debug_is_active); |
4301 __ Ldrb(x0, MemOperand(x10)); | 4301 __ Ldrb(x0, MemOperand(x10)); |
4302 __ SmiTag(x0); | 4302 __ SmiTag(x0); |
4303 context()->Plug(x0); | 4303 context()->Plug(x0); |
4304 } | 4304 } |
4305 | 4305 |
4306 | 4306 |
4307 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4307 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4308 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); | |
4309 if (generator != nullptr) { | |
4310 Comment cmnt(masm_, "[ InlineRuntimeCall"); | |
4311 EmitInlineRuntimeCall(expr, generator); | |
4312 return; | |
4313 } | |
4314 | |
4315 Comment cmnt(masm_, "[ CallRunTime"); | |
4316 ZoneList<Expression*>* args = expr->arguments(); | 4308 ZoneList<Expression*>* args = expr->arguments(); |
4317 int arg_count = args->length(); | 4309 int arg_count = args->length(); |
4318 | 4310 |
4319 if (expr->is_jsruntime()) { | 4311 if (expr->is_jsruntime()) { |
| 4312 Comment cmnt(masm_, "[ CallRunTime"); |
4320 // Push the builtins object as the receiver. | 4313 // Push the builtins object as the receiver. |
4321 __ Ldr(x10, GlobalObjectMemOperand()); | 4314 __ Ldr(x10, GlobalObjectMemOperand()); |
4322 __ Ldr(LoadDescriptor::ReceiverRegister(), | 4315 __ Ldr(LoadDescriptor::ReceiverRegister(), |
4323 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); | 4316 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); |
4324 __ Push(LoadDescriptor::ReceiverRegister()); | 4317 __ Push(LoadDescriptor::ReceiverRegister()); |
4325 | 4318 |
4326 // Load the function from the receiver. | 4319 // Load the function from the receiver. |
4327 Handle<String> name = expr->name(); | 4320 Handle<String> name = expr->name(); |
4328 __ Mov(LoadDescriptor::NameRegister(), Operand(name)); | 4321 __ Mov(LoadDescriptor::NameRegister(), Operand(name)); |
4329 if (FLAG_vector_ics) { | 4322 if (FLAG_vector_ics) { |
4330 __ Mov(VectorLoadICDescriptor::SlotRegister(), | 4323 __ Mov(VectorLoadICDescriptor::SlotRegister(), |
4331 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); | 4324 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
4332 CallLoadIC(NOT_CONTEXTUAL); | 4325 CallLoadIC(NOT_CONTEXTUAL); |
4333 } else { | 4326 } else { |
4334 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4327 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
4335 } | 4328 } |
4336 | 4329 |
4337 // Push the target function under the receiver. | 4330 // Push the target function under the receiver. |
4338 __ Pop(x10); | 4331 __ Pop(x10); |
4339 __ Push(x0, x10); | 4332 __ Push(x0, x10); |
4340 | 4333 |
4341 int arg_count = args->length(); | |
4342 for (int i = 0; i < arg_count; i++) { | 4334 for (int i = 0; i < arg_count; i++) { |
4343 VisitForStackValue(args->at(i)); | 4335 VisitForStackValue(args->at(i)); |
4344 } | 4336 } |
4345 | 4337 |
4346 // Record source position of the IC call. | 4338 // Record source position of the IC call. |
4347 SetSourcePosition(expr->position()); | 4339 SetSourcePosition(expr->position()); |
4348 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4340 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4349 __ Peek(x1, (arg_count + 1) * kPointerSize); | 4341 __ Peek(x1, (arg_count + 1) * kPointerSize); |
4350 __ CallStub(&stub); | 4342 __ CallStub(&stub); |
4351 | 4343 |
4352 // Restore context register. | 4344 // Restore context register. |
4353 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4345 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4354 | 4346 |
4355 context()->DropAndPlug(1, x0); | 4347 context()->DropAndPlug(1, x0); |
| 4348 |
4356 } else { | 4349 } else { |
4357 // Push the arguments ("left-to-right"). | 4350 const Runtime::Function* function = expr->function(); |
4358 for (int i = 0; i < arg_count; i++) { | 4351 switch (function->function_id) { |
4359 VisitForStackValue(args->at(i)); | 4352 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 4353 case Runtime::kInline##Name: { \ |
| 4354 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 4355 return Emit##Name(expr); \ |
| 4356 } |
| 4357 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 4358 #undef CALL_INTRINSIC_GENERATOR |
| 4359 default: { |
| 4360 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 4361 // Push the arguments ("left-to-right"). |
| 4362 for (int i = 0; i < arg_count; i++) { |
| 4363 VisitForStackValue(args->at(i)); |
| 4364 } |
| 4365 |
| 4366 // Call the C runtime function. |
| 4367 __ CallRuntime(expr->function(), arg_count); |
| 4368 context()->Plug(x0); |
| 4369 } |
4360 } | 4370 } |
4361 | |
4362 // Call the C runtime function. | |
4363 __ CallRuntime(expr->function(), arg_count); | |
4364 context()->Plug(x0); | |
4365 } | 4371 } |
4366 } | 4372 } |
4367 | 4373 |
4368 | 4374 |
4369 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4375 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4370 switch (expr->op()) { | 4376 switch (expr->op()) { |
4371 case Token::DELETE: { | 4377 case Token::DELETE: { |
4372 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4378 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4373 Property* property = expr->expression()->AsProperty(); | 4379 Property* property = expr->expression()->AsProperty(); |
4374 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4380 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5504 return previous_; | 5510 return previous_; |
5505 } | 5511 } |
5506 | 5512 |
5507 | 5513 |
5508 #undef __ | 5514 #undef __ |
5509 | 5515 |
5510 | 5516 |
5511 } } // namespace v8::internal | 5517 } } // namespace v8::internal |
5512 | 5518 |
5513 #endif // V8_TARGET_ARCH_ARM64 | 5519 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |