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

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

Issue 1928213002: X87: [api] Expose FunctionCallbackInfo::NewTarget. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/x87/builtins-x87.cc ('k') | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
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 5343 matching lines...) Expand 10 before | Expand all | Expand 10 after
5354 5354
5355 typedef FunctionCallbackArguments FCA; 5355 typedef FunctionCallbackArguments FCA;
5356 5356
5357 STATIC_ASSERT(FCA::kContextSaveIndex == 6); 5357 STATIC_ASSERT(FCA::kContextSaveIndex == 6);
5358 STATIC_ASSERT(FCA::kCalleeIndex == 5); 5358 STATIC_ASSERT(FCA::kCalleeIndex == 5);
5359 STATIC_ASSERT(FCA::kDataIndex == 4); 5359 STATIC_ASSERT(FCA::kDataIndex == 4);
5360 STATIC_ASSERT(FCA::kReturnValueOffset == 3); 5360 STATIC_ASSERT(FCA::kReturnValueOffset == 3);
5361 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2); 5361 STATIC_ASSERT(FCA::kReturnValueDefaultValueIndex == 2);
5362 STATIC_ASSERT(FCA::kIsolateIndex == 1); 5362 STATIC_ASSERT(FCA::kIsolateIndex == 1);
5363 STATIC_ASSERT(FCA::kHolderIndex == 0); 5363 STATIC_ASSERT(FCA::kHolderIndex == 0);
5364 STATIC_ASSERT(FCA::kArgsLength == 7); 5364 STATIC_ASSERT(FCA::kNewTargetIndex == 7);
5365 STATIC_ASSERT(FCA::kArgsLength == 8);
5365 5366
5366 __ pop(return_address); 5367 __ pop(return_address);
5368
5369 // new target
5370 __ PushRoot(Heap::kUndefinedValueRootIndex);
5371
5367 // context save. 5372 // context save.
5368 __ push(context); 5373 __ push(context);
5369 5374
5370 // callee 5375 // callee
5371 __ push(callee); 5376 __ push(callee);
5372 5377
5373 // call data 5378 // call data
5374 __ push(call_data); 5379 __ push(call_data);
5375 5380
5376 Register scratch = call_data; 5381 Register scratch = call_data;
(...skipping 24 matching lines...) Expand all
5401 } 5406 }
5402 5407
5403 // API function gets reference to the v8::Arguments. If CPU profiler 5408 // API function gets reference to the v8::Arguments. If CPU profiler
5404 // is enabled wrapper function will be called and we need to pass 5409 // is enabled wrapper function will be called and we need to pass
5405 // address of the callback as additional parameter, always allocate 5410 // address of the callback as additional parameter, always allocate
5406 // space for it. 5411 // space for it.
5407 const int kApiArgc = 1 + 1; 5412 const int kApiArgc = 1 + 1;
5408 5413
5409 // Allocate the v8::Arguments structure in the arguments' space since 5414 // Allocate the v8::Arguments structure in the arguments' space since
5410 // it's not controlled by GC. 5415 // it's not controlled by GC.
5411 const int kApiStackSpace = 4; 5416 const int kApiStackSpace = 3;
5412 5417
5413 PrepareCallApiFunction(masm, kApiArgc + kApiStackSpace); 5418 PrepareCallApiFunction(masm, kApiArgc + kApiStackSpace);
5414 5419
5415 // FunctionCallbackInfo::implicit_args_. 5420 // FunctionCallbackInfo::implicit_args_.
5416 __ mov(ApiParameterOperand(2), scratch); 5421 __ mov(ApiParameterOperand(2), scratch);
5417 __ add(scratch, Immediate((argc() + FCA::kArgsLength - 1) * kPointerSize)); 5422 __ add(scratch, Immediate((argc() + FCA::kArgsLength - 1) * kPointerSize));
5418 // FunctionCallbackInfo::values_. 5423 // FunctionCallbackInfo::values_.
5419 __ mov(ApiParameterOperand(3), scratch); 5424 __ mov(ApiParameterOperand(3), scratch);
5420 // FunctionCallbackInfo::length_. 5425 // FunctionCallbackInfo::length_.
5421 __ Move(ApiParameterOperand(4), Immediate(argc())); 5426 __ Move(ApiParameterOperand(4), Immediate(argc()));
5422 // FunctionCallbackInfo::is_construct_call_.
5423 __ Move(ApiParameterOperand(5), Immediate(0));
5424 5427
5425 // v8::InvocationCallback's argument. 5428 // v8::InvocationCallback's argument.
5426 __ lea(scratch, ApiParameterOperand(2)); 5429 __ lea(scratch, ApiParameterOperand(2));
5427 __ mov(ApiParameterOperand(0), scratch); 5430 __ mov(ApiParameterOperand(0), scratch);
5428 5431
5429 ExternalReference thunk_ref = 5432 ExternalReference thunk_ref =
5430 ExternalReference::invoke_function_callback(masm->isolate()); 5433 ExternalReference::invoke_function_callback(masm->isolate());
5431 5434
5432 Operand context_restore_operand(ebp, 5435 Operand context_restore_operand(ebp,
5433 (2 + FCA::kContextSaveIndex) * kPointerSize); 5436 (2 + FCA::kContextSaveIndex) * kPointerSize);
5434 // Stores return the first js argument 5437 // Stores return the first js argument
5435 int return_value_offset = 0; 5438 int return_value_offset = 0;
5436 if (is_store()) { 5439 if (is_store()) {
5437 return_value_offset = 2 + FCA::kArgsLength; 5440 return_value_offset = 2 + FCA::kArgsLength;
5438 } else { 5441 } else {
5439 return_value_offset = 2 + FCA::kReturnValueOffset; 5442 return_value_offset = 2 + FCA::kReturnValueOffset;
5440 } 5443 }
5441 Operand return_value_operand(ebp, return_value_offset * kPointerSize); 5444 Operand return_value_operand(ebp, return_value_offset * kPointerSize);
5442 int stack_space = 0; 5445 int stack_space = 0;
5443 Operand is_construct_call_operand = ApiParameterOperand(5); 5446 Operand length_operand = ApiParameterOperand(4);
5444 Operand* stack_space_operand = &is_construct_call_operand; 5447 Operand* stack_space_operand = &length_operand;
5445 stack_space = argc() + FCA::kArgsLength + 1; 5448 stack_space = argc() + FCA::kArgsLength + 1;
5446 stack_space_operand = nullptr; 5449 stack_space_operand = nullptr;
5447 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5450 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5448 ApiParameterOperand(1), stack_space, 5451 ApiParameterOperand(1), stack_space,
5449 stack_space_operand, return_value_operand, 5452 stack_space_operand, return_value_operand,
5450 &context_restore_operand); 5453 &context_restore_operand);
5451 } 5454 }
5452 5455
5453 5456
5454 void CallApiGetterStub::Generate(MacroAssembler* masm) { 5457 void CallApiGetterStub::Generate(MacroAssembler* masm) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 kStackUnwindSpace, nullptr, return_value_operand, 5524 kStackUnwindSpace, nullptr, return_value_operand,
5522 NULL); 5525 NULL);
5523 } 5526 }
5524 5527
5525 #undef __ 5528 #undef __
5526 5529
5527 } // namespace internal 5530 } // namespace internal
5528 } // namespace v8 5531 } // namespace v8
5529 5532
5530 #endif // V8_TARGET_ARCH_X87 5533 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698