| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 }; | 446 }; |
| 447 static Representation representations[] = { | 447 static Representation representations[] = { |
| 448 Representation::Tagged(), // context | 448 Representation::Tagged(), // context |
| 449 Representation::Tagged(), // receiver | 449 Representation::Tagged(), // receiver |
| 450 }; | 450 }; |
| 451 descriptor->register_param_count_ = 2; | 451 descriptor->register_param_count_ = 2; |
| 452 descriptor->register_params_ = registers; | 452 descriptor->register_params_ = registers; |
| 453 descriptor->param_representations_ = representations; | 453 descriptor->param_representations_ = representations; |
| 454 descriptor->platform_specific_descriptor_ = &default_descriptor; | 454 descriptor->platform_specific_descriptor_ = &default_descriptor; |
| 455 } | 455 } |
| 456 { |
| 457 CallInterfaceDescriptor* descriptor = |
| 458 isolate->call_descriptor(Isolate::ApiFunctionCall); |
| 459 static Register registers[] = { r0, // callee |
| 460 r4, // call_data |
| 461 r2, // holder |
| 462 r1, // api_function_address |
| 463 cp, // context |
| 464 }; |
| 465 static Representation representations[] = { |
| 466 Representation::Tagged(), // callee |
| 467 Representation::Tagged(), // call_data |
| 468 Representation::Tagged(), // holder |
| 469 Representation::External(), // api_function_address |
| 470 Representation::Tagged(), // context |
| 471 }; |
| 472 descriptor->register_param_count_ = 5; |
| 473 descriptor->register_params_ = registers; |
| 474 descriptor->param_representations_ = representations; |
| 475 descriptor->platform_specific_descriptor_ = &default_descriptor; |
| 476 } |
| 456 } | 477 } |
| 457 | 478 |
| 458 | 479 |
| 459 #define __ ACCESS_MASM(masm) | 480 #define __ ACCESS_MASM(masm) |
| 460 | 481 |
| 461 | 482 |
| 462 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 483 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
| 463 Label* slow, | 484 Label* slow, |
| 464 Condition cond); | 485 Condition cond); |
| 465 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 486 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
| (...skipping 4906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5372 __ bind(&fast_elements_case); | 5393 __ bind(&fast_elements_case); |
| 5373 GenerateCase(masm, FAST_ELEMENTS); | 5394 GenerateCase(masm, FAST_ELEMENTS); |
| 5374 } | 5395 } |
| 5375 | 5396 |
| 5376 | 5397 |
| 5377 void CallApiFunctionStub::Generate(MacroAssembler* masm) { | 5398 void CallApiFunctionStub::Generate(MacroAssembler* masm) { |
| 5378 // ----------- S t a t e ------------- | 5399 // ----------- S t a t e ------------- |
| 5379 // -- r0 : callee | 5400 // -- r0 : callee |
| 5380 // -- r4 : call_data | 5401 // -- r4 : call_data |
| 5381 // -- r2 : holder | 5402 // -- r2 : holder |
| 5382 // -- r3 : api_function_address | 5403 // -- r1 : api_function_address |
| 5383 // -- r1 : thunk_arg | |
| 5384 // -- cp : context | 5404 // -- cp : context |
| 5385 // -- | 5405 // -- |
| 5386 // -- sp[0] : last argument | 5406 // -- sp[0] : last argument |
| 5387 // -- ... | 5407 // -- ... |
| 5388 // -- sp[(argc - 1)* 4] : first argument | 5408 // -- sp[(argc - 1)* 4] : first argument |
| 5389 // -- sp[argc * 4] : receiver | 5409 // -- sp[argc * 4] : receiver |
| 5390 // ----------------------------------- | 5410 // ----------------------------------- |
| 5391 | 5411 |
| 5392 Register callee = r0; | 5412 Register callee = r0; |
| 5393 Register call_data = r4; | 5413 Register call_data = r4; |
| 5394 Register holder = r2; | 5414 Register holder = r2; |
| 5395 Register api_function_address = r3; | 5415 Register api_function_address = r1; |
| 5396 Register thunk_arg = r1; | |
| 5397 Register context = cp; | 5416 Register context = cp; |
| 5398 | 5417 |
| 5399 int argc = ArgumentBits::decode(bit_field_); | 5418 int argc = ArgumentBits::decode(bit_field_); |
| 5400 bool restore_context = RestoreContextBits::decode(bit_field_); | 5419 bool restore_context = RestoreContextBits::decode(bit_field_); |
| 5401 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); | 5420 bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_); |
| 5402 | 5421 |
| 5403 typedef FunctionCallbackArguments FCA; | 5422 typedef FunctionCallbackArguments FCA; |
| 5404 | 5423 |
| 5405 STATIC_ASSERT(FCA::kContextSaveIndex == 6); | 5424 STATIC_ASSERT(FCA::kContextSaveIndex == 6); |
| 5406 STATIC_ASSERT(FCA::kCalleeIndex == 5); | 5425 STATIC_ASSERT(FCA::kCalleeIndex == 5); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5442 // Prepare arguments. | 5461 // Prepare arguments. |
| 5443 __ mov(scratch, sp); | 5462 __ mov(scratch, sp); |
| 5444 | 5463 |
| 5445 // Allocate the v8::Arguments structure in the arguments' space since | 5464 // Allocate the v8::Arguments structure in the arguments' space since |
| 5446 // it's not controlled by GC. | 5465 // it's not controlled by GC. |
| 5447 const int kApiStackSpace = 4; | 5466 const int kApiStackSpace = 4; |
| 5448 | 5467 |
| 5449 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5468 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5450 __ EnterExitFrame(false, kApiStackSpace); | 5469 __ EnterExitFrame(false, kApiStackSpace); |
| 5451 | 5470 |
| 5452 ASSERT(!thunk_arg.is(r0) && !api_function_address.is(r0) && !scratch.is(r0)); | 5471 ASSERT(!api_function_address.is(r0) && !scratch.is(r0)); |
| 5453 // r0 = FunctionCallbackInfo& | 5472 // r0 = FunctionCallbackInfo& |
| 5454 // Arguments is after the return address. | 5473 // Arguments is after the return address. |
| 5455 __ add(r0, sp, Operand(1 * kPointerSize)); | 5474 __ add(r0, sp, Operand(1 * kPointerSize)); |
| 5456 // FunctionCallbackInfo::implicit_args_ | 5475 // FunctionCallbackInfo::implicit_args_ |
| 5457 __ str(scratch, MemOperand(r0, 0 * kPointerSize)); | 5476 __ str(scratch, MemOperand(r0, 0 * kPointerSize)); |
| 5458 // FunctionCallbackInfo::values_ | 5477 // FunctionCallbackInfo::values_ |
| 5459 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize)); | 5478 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc) * kPointerSize)); |
| 5460 __ str(ip, MemOperand(r0, 1 * kPointerSize)); | 5479 __ str(ip, MemOperand(r0, 1 * kPointerSize)); |
| 5461 // FunctionCallbackInfo::length_ = argc | 5480 // FunctionCallbackInfo::length_ = argc |
| 5462 __ mov(ip, Operand(argc)); | 5481 __ mov(ip, Operand(argc)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5473 masm->isolate()); | 5492 masm->isolate()); |
| 5474 | 5493 |
| 5475 AllowExternalCallThatCantCauseGC scope(masm); | 5494 AllowExternalCallThatCantCauseGC scope(masm); |
| 5476 MemOperand context_restore_operand( | 5495 MemOperand context_restore_operand( |
| 5477 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); | 5496 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); |
| 5478 MemOperand return_value_operand(fp, | 5497 MemOperand return_value_operand(fp, |
| 5479 (2 + FCA::kReturnValueOffset) * kPointerSize); | 5498 (2 + FCA::kReturnValueOffset) * kPointerSize); |
| 5480 | 5499 |
| 5481 __ CallApiFunctionAndReturn(api_function_address, | 5500 __ CallApiFunctionAndReturn(api_function_address, |
| 5482 thunk_ref, | 5501 thunk_ref, |
| 5483 thunk_arg, | |
| 5484 kStackUnwindSpace, | 5502 kStackUnwindSpace, |
| 5485 return_value_operand, | 5503 return_value_operand, |
| 5486 restore_context ? | 5504 restore_context ? |
| 5487 &context_restore_operand : NULL); | 5505 &context_restore_operand : NULL); |
| 5488 } | 5506 } |
| 5489 | 5507 |
| 5490 | 5508 |
| 5491 void CallApiGetterStub::Generate(MacroAssembler* masm) { | 5509 void CallApiGetterStub::Generate(MacroAssembler* masm) { |
| 5492 // ----------- S t a t e ------------- | 5510 // ----------- S t a t e ------------- |
| 5493 // -- sp[0] : name | 5511 // -- sp[0] : name |
| 5494 // -- sp[4 - kArgsLength*4] : PropertyCallbackArguments object | 5512 // -- sp[4 - kArgsLength*4] : PropertyCallbackArguments object |
| 5495 // -- ... | 5513 // -- ... |
| 5496 // -- r3 : api_function_address | 5514 // -- r2 : api_function_address |
| 5497 // -- r2 : thunk_last_arg | |
| 5498 // ----------------------------------- | 5515 // ----------------------------------- |
| 5499 | 5516 |
| 5500 Register api_function_address = r3; | 5517 Register api_function_address = r2; |
| 5501 Register thunk_last_arg = r2; | |
| 5502 | 5518 |
| 5503 __ mov(r0, sp); // r0 = Handle<Name> | 5519 __ mov(r0, sp); // r0 = Handle<Name> |
| 5504 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = PCA | 5520 __ add(r1, r0, Operand(1 * kPointerSize)); // r1 = PCA |
| 5505 | 5521 |
| 5506 const int kApiStackSpace = 1; | 5522 const int kApiStackSpace = 1; |
| 5507 FrameScope frame_scope(masm, StackFrame::MANUAL); | 5523 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 5508 __ EnterExitFrame(false, kApiStackSpace); | 5524 __ EnterExitFrame(false, kApiStackSpace); |
| 5509 | 5525 |
| 5510 // Create PropertyAccessorInfo instance on the stack above the exit frame with | 5526 // Create PropertyAccessorInfo instance on the stack above the exit frame with |
| 5511 // r1 (internal::Object** args_) as the data. | 5527 // r1 (internal::Object** args_) as the data. |
| 5512 __ str(r1, MemOperand(sp, 1 * kPointerSize)); | 5528 __ str(r1, MemOperand(sp, 1 * kPointerSize)); |
| 5513 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& | 5529 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& |
| 5514 | 5530 |
| 5515 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; | 5531 const int kStackUnwindSpace = PropertyCallbackArguments::kArgsLength + 1; |
| 5516 | 5532 |
| 5517 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 5533 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
| 5518 ExternalReference::Type thunk_type = | 5534 ExternalReference::Type thunk_type = |
| 5519 ExternalReference::PROFILING_GETTER_CALL; | 5535 ExternalReference::PROFILING_GETTER_CALL; |
| 5520 ApiFunction thunk_fun(thunk_address); | 5536 ApiFunction thunk_fun(thunk_address); |
| 5521 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, | 5537 ExternalReference thunk_ref = ExternalReference(&thunk_fun, thunk_type, |
| 5522 masm->isolate()); | 5538 masm->isolate()); |
| 5523 __ CallApiFunctionAndReturn(api_function_address, | 5539 __ CallApiFunctionAndReturn(api_function_address, |
| 5524 thunk_ref, | 5540 thunk_ref, |
| 5525 thunk_last_arg, | |
| 5526 kStackUnwindSpace, | 5541 kStackUnwindSpace, |
| 5527 MemOperand(fp, 6 * kPointerSize), | 5542 MemOperand(fp, 6 * kPointerSize), |
| 5528 NULL); | 5543 NULL); |
| 5529 } | 5544 } |
| 5530 | 5545 |
| 5531 | 5546 |
| 5532 #undef __ | 5547 #undef __ |
| 5533 | 5548 |
| 5534 } } // namespace v8::internal | 5549 } } // namespace v8::internal |
| 5535 | 5550 |
| 5536 #endif // V8_TARGET_ARCH_ARM | 5551 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |