| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // x1: left operand | 394 // x1: left operand |
| 395 // x0: right operand | 395 // x0: right operand |
| 396 static Register registers[] = { x1, x0 }; | 396 static Register registers[] = { x1, x0 }; |
| 397 descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]); | 397 descriptor->register_param_count_ = sizeof(registers) / sizeof(registers[0]); |
| 398 descriptor->register_params_ = registers; | 398 descriptor->register_params_ = registers; |
| 399 descriptor->deoptimization_handler_ = | 399 descriptor->deoptimization_handler_ = |
| 400 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 400 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
| 401 } | 401 } |
| 402 | 402 |
| 403 | 403 |
| 404 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
| 405 static PlatformCallInterfaceDescriptor default_descriptor = |
| 406 PlatformCallInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS); |
| 407 |
| 408 static PlatformCallInterfaceDescriptor noInlineDescriptor = |
| 409 PlatformCallInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS); |
| 410 |
| 411 { |
| 412 CallInterfaceDescriptor* descriptor = |
| 413 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
| 414 static Register registers[] = { x1, // JSFunction |
| 415 cp, // context |
| 416 x0, // actual number of arguments |
| 417 x2, // expected number of arguments |
| 418 }; |
| 419 static Representation representations[] = { |
| 420 Representation::Tagged(), // JSFunction |
| 421 Representation::Tagged(), // context |
| 422 Representation::Integer32(), // actual number of arguments |
| 423 Representation::Integer32(), // expected number of arguments |
| 424 }; |
| 425 descriptor->register_param_count_ = 4; |
| 426 descriptor->register_params_ = registers; |
| 427 descriptor->param_representations_ = representations; |
| 428 descriptor->platform_specific_descriptor_ = &default_descriptor; |
| 429 } |
| 430 { |
| 431 CallInterfaceDescriptor* descriptor = |
| 432 isolate->call_descriptor(Isolate::KeyedCall); |
| 433 static Register registers[] = { cp, // context |
| 434 x2, // key |
| 435 }; |
| 436 static Representation representations[] = { |
| 437 Representation::Tagged(), // context |
| 438 Representation::Tagged(), // key |
| 439 }; |
| 440 descriptor->register_param_count_ = 2; |
| 441 descriptor->register_params_ = registers; |
| 442 descriptor->param_representations_ = representations; |
| 443 descriptor->platform_specific_descriptor_ = &noInlineDescriptor; |
| 444 } |
| 445 { |
| 446 CallInterfaceDescriptor* descriptor = |
| 447 isolate->call_descriptor(Isolate::NamedCall); |
| 448 static Register registers[] = { cp, // context |
| 449 x2, // name |
| 450 }; |
| 451 static Representation representations[] = { |
| 452 Representation::Tagged(), // context |
| 453 Representation::Tagged(), // name |
| 454 }; |
| 455 descriptor->register_param_count_ = 2; |
| 456 descriptor->register_params_ = registers; |
| 457 descriptor->param_representations_ = representations; |
| 458 descriptor->platform_specific_descriptor_ = &noInlineDescriptor; |
| 459 } |
| 460 } |
| 461 |
| 462 |
| 404 #define __ ACCESS_MASM(masm) | 463 #define __ ACCESS_MASM(masm) |
| 405 | 464 |
| 406 | 465 |
| 407 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 466 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { |
| 408 // Update the static counter each time a new code stub is generated. | 467 // Update the static counter each time a new code stub is generated. |
| 409 Isolate* isolate = masm->isolate(); | 468 Isolate* isolate = masm->isolate(); |
| 410 isolate->counters()->code_stubs()->Increment(); | 469 isolate->counters()->code_stubs()->Increment(); |
| 411 | 470 |
| 412 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); | 471 CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(isolate); |
| 413 int param_count = descriptor->register_param_count_; | 472 int param_count = descriptor->register_param_count_; |
| (...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3381 GenerateRecordCallTarget(masm); | 3440 GenerateRecordCallTarget(masm); |
| 3382 } | 3441 } |
| 3383 | 3442 |
| 3384 // Fast-case: Invoke the function now. | 3443 // Fast-case: Invoke the function now. |
| 3385 // x1 function pushed function | 3444 // x1 function pushed function |
| 3386 ParameterCount actual(argc_); | 3445 ParameterCount actual(argc_); |
| 3387 | 3446 |
| 3388 __ InvokeFunction(function, | 3447 __ InvokeFunction(function, |
| 3389 actual, | 3448 actual, |
| 3390 JUMP_FUNCTION, | 3449 JUMP_FUNCTION, |
| 3391 NullCallWrapper(), | 3450 NullCallWrapper()); |
| 3392 CALL_AS_FUNCTION); | |
| 3393 | 3451 |
| 3394 // Slow-case: Non-function called. | 3452 // Slow-case: Non-function called. |
| 3395 __ Bind(&slow); | 3453 __ Bind(&slow); |
| 3396 if (RecordCallTarget()) { | 3454 if (RecordCallTarget()) { |
| 3397 // If there is a call target cache, mark it megamorphic in the | 3455 // If there is a call target cache, mark it megamorphic in the |
| 3398 // non-function case. MegamorphicSentinel is an immortal immovable object | 3456 // non-function case. MegamorphicSentinel is an immortal immovable object |
| 3399 // (undefined) so no write barrier is needed. | 3457 // (undefined) so no write barrier is needed. |
| 3400 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), | 3458 ASSERT_EQ(*TypeFeedbackCells::MegamorphicSentinel(masm->isolate()), |
| 3401 masm->isolate()->heap()->undefined_value()); | 3459 masm->isolate()->heap()->undefined_value()); |
| 3402 __ LoadRoot(x11, Heap::kUndefinedValueRootIndex); | 3460 __ LoadRoot(x11, Heap::kUndefinedValueRootIndex); |
| 3403 __ Str(x11, FieldMemOperand(cache_cell, Cell::kValueOffset)); | 3461 __ Str(x11, FieldMemOperand(cache_cell, Cell::kValueOffset)); |
| 3404 } | 3462 } |
| 3405 // Check for function proxy. | 3463 // Check for function proxy. |
| 3406 // x10 : function type. | 3464 // x10 : function type. |
| 3407 __ Cmp(x10, JS_FUNCTION_PROXY_TYPE); | 3465 __ Cmp(x10, JS_FUNCTION_PROXY_TYPE); |
| 3408 __ B(ne, &non_function); | 3466 __ B(ne, &non_function); |
| 3409 __ Push(function); // put proxy as additional argument | 3467 __ Push(function); // put proxy as additional argument |
| 3410 __ Mov(x0, argc_ + 1); | 3468 __ Mov(x0, argc_ + 1); |
| 3411 __ Mov(x2, 0); | 3469 __ Mov(x2, 0); |
| 3412 __ GetBuiltinEntry(x3, Builtins::CALL_FUNCTION_PROXY); | 3470 __ GetBuiltinFunction(x1, Builtins::CALL_FUNCTION_PROXY); |
| 3413 __ SetCallKind(x5, CALL_AS_METHOD); | |
| 3414 { | 3471 { |
| 3415 Handle<Code> adaptor = | 3472 Handle<Code> adaptor = |
| 3416 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 3473 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 3417 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 3474 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
| 3418 } | 3475 } |
| 3419 | 3476 |
| 3420 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 3477 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 3421 // of the original receiver from the call site). | 3478 // of the original receiver from the call site). |
| 3422 __ Bind(&non_function); | 3479 __ Bind(&non_function); |
| 3423 __ Poke(function, argc_ * kXRegSizeInBytes); | 3480 __ Poke(function, argc_ * kXRegSizeInBytes); |
| 3424 __ Mov(x0, argc_); // Set up the number of arguments. | 3481 __ Mov(x0, argc_); // Set up the number of arguments. |
| 3425 __ Mov(x2, 0); | 3482 __ Mov(x2, 0); |
| 3426 __ GetBuiltinEntry(x3, Builtins::CALL_NON_FUNCTION); | 3483 __ GetBuiltinFunction(function, Builtins::CALL_NON_FUNCTION); |
| 3427 __ SetCallKind(x5, CALL_AS_FUNCTION); | |
| 3428 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3484 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3429 RelocInfo::CODE_TARGET); | 3485 RelocInfo::CODE_TARGET); |
| 3430 } | 3486 } |
| 3431 | 3487 |
| 3432 | 3488 |
| 3433 void CallConstructStub::Generate(MacroAssembler* masm) { | 3489 void CallConstructStub::Generate(MacroAssembler* masm) { |
| 3434 ASM_LOCATION("CallConstructStub::Generate"); | 3490 ASM_LOCATION("CallConstructStub::Generate"); |
| 3435 // x0 : number of arguments | 3491 // x0 : number of arguments |
| 3436 // x1 : the function to call | 3492 // x1 : the function to call |
| 3437 // x2 : cache cell for call target | 3493 // x2 : cache cell for call target |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3459 __ Ldr(cons_stub, | 3515 __ Ldr(cons_stub, |
| 3460 FieldMemOperand(shared_func_info, | 3516 FieldMemOperand(shared_func_info, |
| 3461 SharedFunctionInfo::kConstructStubOffset)); | 3517 SharedFunctionInfo::kConstructStubOffset)); |
| 3462 __ Add(cons_stub_code, cons_stub, Code::kHeaderSize - kHeapObjectTag); | 3518 __ Add(cons_stub_code, cons_stub, Code::kHeaderSize - kHeapObjectTag); |
| 3463 __ Br(cons_stub_code); | 3519 __ Br(cons_stub_code); |
| 3464 | 3520 |
| 3465 Label do_call; | 3521 Label do_call; |
| 3466 __ Bind(&slow); | 3522 __ Bind(&slow); |
| 3467 __ Cmp(object_type, JS_FUNCTION_PROXY_TYPE); | 3523 __ Cmp(object_type, JS_FUNCTION_PROXY_TYPE); |
| 3468 __ B(ne, &non_function_call); | 3524 __ B(ne, &non_function_call); |
| 3469 Register builtin = x3; | 3525 __ GetBuiltinFunction(x1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
| 3470 __ GetBuiltinEntry(builtin, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | |
| 3471 __ B(&do_call); | 3526 __ B(&do_call); |
| 3472 | 3527 |
| 3473 __ Bind(&non_function_call); | 3528 __ Bind(&non_function_call); |
| 3474 __ GetBuiltinEntry(builtin, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 3529 __ GetBuiltinFunction(x1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 3475 | 3530 |
| 3476 __ Bind(&do_call); | 3531 __ Bind(&do_call); |
| 3477 // Set expected number of arguments to zero (not changing x0). | 3532 // Set expected number of arguments to zero (not changing x0). |
| 3478 __ Mov(x2, 0); | 3533 __ Mov(x2, 0); |
| 3479 __ SetCallKind(x5, CALL_AS_METHOD); | |
| 3480 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 3534 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 3481 RelocInfo::CODE_TARGET); | 3535 RelocInfo::CODE_TARGET); |
| 3482 } | 3536 } |
| 3483 | 3537 |
| 3484 | 3538 |
| 3485 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 3539 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 3486 // If the receiver is a smi trigger the non-string case. | 3540 // If the receiver is a smi trigger the non-string case. |
| 3487 __ JumpIfSmi(object_, receiver_not_string_); | 3541 __ JumpIfSmi(object_, receiver_not_string_); |
| 3488 | 3542 |
| 3489 // Fetch the instance type of the receiver into result register. | 3543 // Fetch the instance type of the receiver into result register. |
| (...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5231 __ Mov(x1, x0); | 5285 __ Mov(x1, x0); |
| 5232 int parameter_count_offset = | 5286 int parameter_count_offset = |
| 5233 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; | 5287 StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset; |
| 5234 __ Ldr(x0, MemOperand(fp, parameter_count_offset)); | 5288 __ Ldr(x0, MemOperand(fp, parameter_count_offset)); |
| 5235 // The parameter count above includes the receiver for the arguments passed to | 5289 // The parameter count above includes the receiver for the arguments passed to |
| 5236 // the deoptimization handler. Subtract the receiver for the parameter count | 5290 // the deoptimization handler. Subtract the receiver for the parameter count |
| 5237 // for the call. | 5291 // for the call. |
| 5238 __ Sub(x0, x0, 1); | 5292 __ Sub(x0, x0, 1); |
| 5239 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 5293 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 5240 ParameterCount argument_count(x0); | 5294 ParameterCount argument_count(x0); |
| 5241 __ InvokeFunction( | 5295 __ InvokeFunction(x1, argument_count, JUMP_FUNCTION, NullCallWrapper()); |
| 5242 x1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); | |
| 5243 } | 5296 } |
| 5244 | 5297 |
| 5245 | 5298 |
| 5246 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | 5299 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { |
| 5247 if (masm->isolate()->function_entry_hook() != NULL) { | 5300 if (masm->isolate()->function_entry_hook() != NULL) { |
| 5248 // TODO(all): This needs to be reliably consistent with | 5301 // TODO(all): This needs to be reliably consistent with |
| 5249 // kReturnAddressDistanceFromFunctionStart in ::Generate. | 5302 // kReturnAddressDistanceFromFunctionStart in ::Generate. |
| 5250 Assembler::BlockConstPoolScope no_const_pools(masm); | 5303 Assembler::BlockConstPoolScope no_const_pools(masm); |
| 5251 ProfileEntryHookStub stub; | 5304 ProfileEntryHookStub stub; |
| 5252 __ Push(lr); | 5305 __ Push(lr); |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5922 __ Bind(&fast_elements_case); | 5975 __ Bind(&fast_elements_case); |
| 5923 GenerateCase(masm, FAST_ELEMENTS); | 5976 GenerateCase(masm, FAST_ELEMENTS); |
| 5924 } | 5977 } |
| 5925 | 5978 |
| 5926 | 5979 |
| 5927 #undef __ | 5980 #undef __ |
| 5928 | 5981 |
| 5929 } } // namespace v8::internal | 5982 } } // namespace v8::internal |
| 5930 | 5983 |
| 5931 #endif // V8_TARGET_ARCH_A64 | 5984 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |