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

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

Issue 1359583002: [builtins] Add support for NewTarget to Execution::New. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Merge mips and mips64 ports. Created 5 years, 3 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/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after
2463 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); 2463 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
2464 } 2464 }
2465 2465
2466 2466
2467 void CallConstructStub::Generate(MacroAssembler* masm) { 2467 void CallConstructStub::Generate(MacroAssembler* masm) {
2468 // r0 : number of arguments 2468 // r0 : number of arguments
2469 // r1 : the function to call 2469 // r1 : the function to call
2470 // r2 : feedback vector 2470 // r2 : feedback vector
2471 // r3 : slot in feedback vector (Smi, for RecordCallTarget) 2471 // r3 : slot in feedback vector (Smi, for RecordCallTarget)
2472 // r4 : original constructor (for IsSuperConstructorCall) 2472 // r4 : original constructor (for IsSuperConstructorCall)
2473 Label slow, non_function_call;
2474 2473
2474 Label non_function;
2475 // Check that the function is not a smi. 2475 // Check that the function is not a smi.
2476 __ JumpIfSmi(r1, &non_function_call); 2476 __ JumpIfSmi(r1, &non_function);
2477 // Check that the function is a JSFunction. 2477 // Check that the function is a JSFunction.
2478 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE); 2478 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE);
2479 __ b(ne, &slow); 2479 __ b(ne, &non_function);
2480 2480
2481 if (RecordCallTarget()) { 2481 if (RecordCallTarget()) {
2482 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); 2482 GenerateRecordCallTarget(masm, IsSuperConstructorCall());
2483 2483
2484 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2484 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2485 Label feedback_register_initialized; 2485 Label feedback_register_initialized;
2486 // Put the AllocationSite from the feedback vector into r2, or undefined. 2486 // Put the AllocationSite from the feedback vector into r2, or undefined.
2487 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2487 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize));
2488 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); 2488 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset));
2489 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 2489 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
2490 __ b(eq, &feedback_register_initialized); 2490 __ b(eq, &feedback_register_initialized);
2491 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 2491 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
2492 __ bind(&feedback_register_initialized); 2492 __ bind(&feedback_register_initialized);
2493 2493
2494 __ AssertUndefinedOrAllocationSite(r2, r5); 2494 __ AssertUndefinedOrAllocationSite(r2, r5);
2495 } 2495 }
2496 2496
2497 // Pass function as original constructor. 2497 // Pass function as original constructor.
2498 if (IsSuperConstructorCall()) { 2498 if (IsSuperConstructorCall()) {
2499 __ mov(r3, r4); 2499 __ mov(r3, r4);
2500 } else { 2500 } else {
2501 __ mov(r3, r1); 2501 __ mov(r3, r1);
2502 } 2502 }
2503 2503
2504 // Jump to the function-specific construct stub. 2504 // Tail call to the function-specific construct stub (still in the caller
2505 Register jmp_reg = r4; 2505 // context at this point).
2506 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 2506 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
2507 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, 2507 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset));
2508 SharedFunctionInfo::kConstructStubOffset)); 2508 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag));
2509 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2510 2509
2511 // r0: number of arguments 2510 __ bind(&non_function);
2512 // r1: called object 2511 __ mov(r3, r1);
2513 // r5: object type 2512 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2514 __ bind(&slow);
2515 {
2516 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
2517 __ b(ne, &non_function_call);
2518 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
2519 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset));
2520 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2521
2522 __ bind(&non_function_call);
2523 {
2524 // Determine the delegate for the target (if any).
2525 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
2526 __ SmiTag(r0);
2527 __ Push(r0, r1);
2528 __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
2529 __ mov(r1, r0);
2530 __ Pop(r0);
2531 __ SmiUntag(r0);
2532 }
2533 // The delegate is always a regular function.
2534 __ AssertFunction(r1);
2535 __ Jump(masm->isolate()->builtins()->CallFunction(),
2536 RelocInfo::CODE_TARGET);
2537 }
2538 } 2513 }
2539 2514
2540 2515
2541 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { 2516 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
2542 __ ldr(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2517 __ ldr(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2543 __ ldr(vector, FieldMemOperand(vector, 2518 __ ldr(vector, FieldMemOperand(vector,
2544 JSFunction::kSharedFunctionInfoOffset)); 2519 JSFunction::kSharedFunctionInfoOffset));
2545 __ ldr(vector, FieldMemOperand(vector, 2520 __ ldr(vector, FieldMemOperand(vector,
2546 SharedFunctionInfo::kFeedbackVectorOffset)); 2521 SharedFunctionInfo::kFeedbackVectorOffset));
2547 } 2522 }
(...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after
5549 MemOperand(fp, 6 * kPointerSize), NULL); 5524 MemOperand(fp, 6 * kPointerSize), NULL);
5550 } 5525 }
5551 5526
5552 5527
5553 #undef __ 5528 #undef __
5554 5529
5555 } // namespace internal 5530 } // namespace internal
5556 } // namespace v8 5531 } // namespace v8
5557 5532
5558 #endif // V8_TARGET_ARCH_ARM 5533 #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