Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1910253005: [api] Expose FunctionCallbackInfo::NewTarget (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a TODO Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 5401 matching lines...) Expand 10 before | Expand all | Expand 10 after
5412 5412
5413 typedef FunctionCallbackArguments FCA; 5413 typedef FunctionCallbackArguments FCA;
5414 5414
5415 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5415 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5416 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5416 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5417 STATIC_ASSERT(FCA::kDataIndex == 4); 5417 STATIC_ASSERT(FCA::kDataIndex == 4);
5418 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5418 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5419 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5419 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5420 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5420 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5421 STATIC_ASSERT(FCA::kHolderIndex == 0); 5421 STATIC_ASSERT(FCA::kHolderIndex == 0);
5422 STATIC_ASSERT(FCA::kArgsLength == 7); 5422 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5423 STATIC_ASSERT(FCA::kArgsLength == 8);
5424
5425 // new target
5426 __ PushRoot(Heap::kUndefinedValueRootIndex);
5423 5427
5424 // context save 5428 // context save
5425 __ push(context); 5429 __ push(context);
5426 if (!is_lazy()) { 5430 if (!is_lazy()) {
5427 // load context from callee 5431 // load context from callee
5428 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset)); 5432 __ ldr(context, FieldMemOperand(callee, JSFunction::kContextOffset));
5429 } 5433 }
5430 5434
5431 // callee 5435 // callee
5432 __ push(callee); 5436 __ push(callee);
(...skipping 13 matching lines...) Expand all
5446 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate()))); 5450 __ mov(scratch, Operand(ExternalReference::isolate_address(masm->isolate())));
5447 __ push(scratch); 5451 __ push(scratch);
5448 // holder 5452 // holder
5449 __ push(holder); 5453 __ push(holder);
5450 5454
5451 // Prepare arguments. 5455 // Prepare arguments.
5452 __ mov(scratch, sp); 5456 __ mov(scratch, sp);
5453 5457
5454 // Allocate the v8::Arguments structure in the arguments' space since 5458 // Allocate the v8::Arguments structure in the arguments' space since
5455 // it's not controlled by GC. 5459 // it's not controlled by GC.
5456 const int kApiStackSpace = 4; 5460 const int kApiStackSpace = 3;
5457 5461
5458 FrameScope frame_scope(masm, StackFrame::MANUAL); 5462 FrameScope frame_scope(masm, StackFrame::MANUAL);
5459 __ EnterExitFrame(false, kApiStackSpace); 5463 __ EnterExitFrame(false, kApiStackSpace);
5460 5464
5461 DCHECK(!api_function_address.is(r0) && !scratch.is(r0)); 5465 DCHECK(!api_function_address.is(r0) && !scratch.is(r0));
5462 // r0 = FunctionCallbackInfo& 5466 // r0 = FunctionCallbackInfo&
5463 // Arguments is after the return address. 5467 // Arguments is after the return address.
5464 __ add(r0, sp, Operand(1 * kPointerSize)); 5468 __ add(r0, sp, Operand(1 * kPointerSize));
5465 // FunctionCallbackInfo::implicit_args_ 5469 // FunctionCallbackInfo::implicit_args_
5466 __ str(scratch, MemOperand(r0, 0 * kPointerSize)); 5470 __ str(scratch, MemOperand(r0, 0 * kPointerSize));
5467 // FunctionCallbackInfo::values_ 5471 // FunctionCallbackInfo::values_
5468 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize)); 5472 __ add(ip, scratch, Operand((FCA::kArgsLength - 1 + argc()) * kPointerSize));
5469 __ str(ip, MemOperand(r0, 1 * kPointerSize)); 5473 __ str(ip, MemOperand(r0, 1 * kPointerSize));
5470 // FunctionCallbackInfo::length_ = argc 5474 // FunctionCallbackInfo::length_ = argc
5471 __ mov(ip, Operand(argc())); 5475 __ mov(ip, Operand(argc()));
5472 __ str(ip, MemOperand(r0, 2 * kPointerSize)); 5476 __ str(ip, MemOperand(r0, 2 * kPointerSize));
5473 // FunctionCallbackInfo::is_construct_call_ = 0
5474 __ mov(ip, Operand::Zero());
5475 __ str(ip, MemOperand(r0, 3 * kPointerSize));
5476 5477
5477 ExternalReference thunk_ref = 5478 ExternalReference thunk_ref =
5478 ExternalReference::invoke_function_callback(masm->isolate()); 5479 ExternalReference::invoke_function_callback(masm->isolate());
5479 5480
5480 AllowExternalCallThatCantCauseGC scope(masm); 5481 AllowExternalCallThatCantCauseGC scope(masm);
5481 MemOperand context_restore_operand( 5482 MemOperand context_restore_operand(
5482 fp, (2 + FCA::kContextSaveIndex) * kPointerSize); 5483 fp, (2 + FCA::kContextSaveIndex) * kPointerSize);
5483 // Stores return the first js argument 5484 // Stores return the first js argument
5484 int return_value_offset = 0; 5485 int return_value_offset = 0;
5485 if (is_store()) { 5486 if (is_store()) {
5486 return_value_offset = 2 + FCA::kArgsLength; 5487 return_value_offset = 2 + FCA::kArgsLength;
5487 } else { 5488 } else {
5488 return_value_offset = 2 + FCA::kReturnValueOffset; 5489 return_value_offset = 2 + FCA::kReturnValueOffset;
5489 } 5490 }
5490 MemOperand return_value_operand(fp, return_value_offset * kPointerSize); 5491 MemOperand return_value_operand(fp, return_value_offset * kPointerSize);
5491 int stack_space = 0; 5492 int stack_space = 0;
5492 MemOperand is_construct_call_operand = MemOperand(sp, 4 * kPointerSize); 5493 MemOperand length_operand = MemOperand(sp, 3 * kPointerSize);
5493 MemOperand* stack_space_operand = &is_construct_call_operand; 5494 MemOperand* stack_space_operand = &length_operand;
5494 stack_space = argc() + FCA::kArgsLength + 1; 5495 stack_space = argc() + FCA::kArgsLength + 1;
5495 stack_space_operand = NULL; 5496 stack_space_operand = NULL;
5496 5497
5497 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space, 5498 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, stack_space,
5498 stack_space_operand, return_value_operand, 5499 stack_space_operand, return_value_operand,
5499 &context_restore_operand); 5500 &context_restore_operand);
5500 } 5501 }
5501 5502
5502 5503
5503 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5504 void CallApiGetterStub::Generate(MacroAssembler* masm) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5561 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5561 kStackUnwindSpace, NULL, return_value_operand, NULL); 5562 kStackUnwindSpace, NULL, return_value_operand, NULL);
5562 } 5563 }
5563 5564
5564 #undef __ 5565 #undef __
5565 5566
5566 } // namespace internal 5567 } // namespace internal
5567 } // namespace v8 5568 } // namespace v8
5568 5569
5569 #endif // V8_TARGET_ARCH_ARM 5570 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698