| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 200 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 | 204 |
| 205 // static | 205 // static |
| 206 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 206 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
| 207 // ----------- S t a t e ------------- | 207 // ----------- S t a t e ------------- |
| 208 // -- x0 : number of arguments | 208 // -- x0 : number of arguments |
| 209 // -- x1 : constructor function | 209 // -- x1 : constructor function |
| 210 // -- x3 : original constructor | 210 // -- x3 : new target |
| 211 // -- lr : return address | 211 // -- lr : return address |
| 212 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) | 212 // -- sp[(argc - n - 1) * 8] : arg[n] (zero based) |
| 213 // -- sp[argc * 8] : receiver | 213 // -- sp[argc * 8] : receiver |
| 214 // ----------------------------------- | 214 // ----------------------------------- |
| 215 ASM_LOCATION("Builtins::Generate_StringConstructor_ConstructStub"); | 215 ASM_LOCATION("Builtins::Generate_StringConstructor_ConstructStub"); |
| 216 | 216 |
| 217 // 1. Load the first argument into x2 and get rid of the rest (including the | 217 // 1. Load the first argument into x2 and get rid of the rest (including the |
| 218 // receiver). | 218 // receiver). |
| 219 { | 219 { |
| 220 Label no_arguments, done; | 220 Label no_arguments, done; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 240 ToStringStub stub(masm->isolate()); | 240 ToStringStub stub(masm->isolate()); |
| 241 __ Push(x1, x3); | 241 __ Push(x1, x3); |
| 242 __ Move(x0, x2); | 242 __ Move(x0, x2); |
| 243 __ CallStub(&stub); | 243 __ CallStub(&stub); |
| 244 __ Move(x2, x0); | 244 __ Move(x2, x0); |
| 245 __ Pop(x1, x3); | 245 __ Pop(x1, x3); |
| 246 } | 246 } |
| 247 __ Bind(&done_convert); | 247 __ Bind(&done_convert); |
| 248 } | 248 } |
| 249 | 249 |
| 250 // 3. Check if original constructor and constructor differ. | 250 // 3. Check if new target and constructor differ. |
| 251 Label new_object; | 251 Label new_object; |
| 252 __ Cmp(x1, x3); | 252 __ Cmp(x1, x3); |
| 253 __ B(ne, &new_object); | 253 __ B(ne, &new_object); |
| 254 | 254 |
| 255 // 4. Allocate a JSValue wrapper for the string. | 255 // 4. Allocate a JSValue wrapper for the string. |
| 256 { | 256 { |
| 257 // ----------- S t a t e ------------- | 257 // ----------- S t a t e ------------- |
| 258 // -- x2 : the first argument | 258 // -- x2 : the first argument |
| 259 // -- x1 : constructor function | 259 // -- x1 : constructor function |
| 260 // -- x3 : original constructor | 260 // -- x3 : new target |
| 261 // -- lr : return address | 261 // -- lr : return address |
| 262 // ----------------------------------- | 262 // ----------------------------------- |
| 263 __ Allocate(JSValue::kSize, x0, x4, x5, &new_object, TAG_OBJECT); | 263 __ Allocate(JSValue::kSize, x0, x4, x5, &new_object, TAG_OBJECT); |
| 264 | 264 |
| 265 // Initialize the JSValue in eax. | 265 // Initialize the JSValue in eax. |
| 266 __ LoadGlobalFunctionInitialMap(x1, x3, x4); | 266 __ LoadGlobalFunctionInitialMap(x1, x3, x4); |
| 267 __ Str(x3, FieldMemOperand(x0, HeapObject::kMapOffset)); | 267 __ Str(x3, FieldMemOperand(x0, HeapObject::kMapOffset)); |
| 268 __ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex); | 268 __ LoadRoot(x3, Heap::kEmptyFixedArrayRootIndex); |
| 269 __ Str(x3, FieldMemOperand(x0, JSObject::kPropertiesOffset)); | 269 __ Str(x3, FieldMemOperand(x0, JSObject::kPropertiesOffset)); |
| 270 __ Str(x3, FieldMemOperand(x0, JSObject::kElementsOffset)); | 270 __ Str(x3, FieldMemOperand(x0, JSObject::kElementsOffset)); |
| 271 __ Str(x2, FieldMemOperand(x0, JSValue::kValueOffset)); | 271 __ Str(x2, FieldMemOperand(x0, JSValue::kValueOffset)); |
| 272 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 272 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 273 __ Ret(); | 273 __ Ret(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // 5. Fallback to the runtime to create new object. | 276 // 5. Fallback to the runtime to create new object. |
| 277 __ bind(&new_object); | 277 __ bind(&new_object); |
| 278 { | 278 { |
| 279 FrameScope scope(masm, StackFrame::INTERNAL); | 279 FrameScope scope(masm, StackFrame::INTERNAL); |
| 280 __ Push(x2, x1); // first argument, constructor | 280 __ Push(x2, x1); // first argument, constructor |
| 281 __ Push(x1, x3); // constructor, original constructor | 281 __ Push(x1, x3); // constructor, new target |
| 282 __ CallRuntime(Runtime::kNewObject, 2); | 282 __ CallRuntime(Runtime::kNewObject, 2); |
| 283 __ Pop(x1, x2); | 283 __ Pop(x1, x2); |
| 284 } | 284 } |
| 285 __ Str(x2, FieldMemOperand(x0, JSValue::kValueOffset)); | 285 __ Str(x2, FieldMemOperand(x0, JSValue::kValueOffset)); |
| 286 __ Ret(); | 286 __ Ret(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 static void CallRuntimePassFunction(MacroAssembler* masm, | 290 static void CallRuntimePassFunction(MacroAssembler* masm, |
| 291 Runtime::FunctionId function_id) { | 291 Runtime::FunctionId function_id) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 GenerateTailCallToSharedCode(masm); | 332 GenerateTailCallToSharedCode(masm); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 336 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 337 bool is_api_function) { | 337 bool is_api_function) { |
| 338 // ----------- S t a t e ------------- | 338 // ----------- S t a t e ------------- |
| 339 // -- x0 : number of arguments | 339 // -- x0 : number of arguments |
| 340 // -- x1 : constructor function | 340 // -- x1 : constructor function |
| 341 // -- x2 : allocation site or undefined | 341 // -- x2 : allocation site or undefined |
| 342 // -- x3 : original constructor | 342 // -- x3 : new target |
| 343 // -- lr : return address | 343 // -- lr : return address |
| 344 // -- sp[...]: constructor arguments | 344 // -- sp[...]: constructor arguments |
| 345 // ----------------------------------- | 345 // ----------------------------------- |
| 346 | 346 |
| 347 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); | 347 ASM_LOCATION("Builtins::Generate_JSConstructStubHelper"); |
| 348 | 348 |
| 349 Isolate* isolate = masm->isolate(); | 349 Isolate* isolate = masm->isolate(); |
| 350 | 350 |
| 351 // Enter a construct frame. | 351 // Enter a construct frame. |
| 352 { | 352 { |
| 353 FrameScope scope(masm, StackFrame::CONSTRUCT); | 353 FrameScope scope(masm, StackFrame::CONSTRUCT); |
| 354 | 354 |
| 355 // Preserve the four incoming parameters on the stack. | 355 // Preserve the four incoming parameters on the stack. |
| 356 Register argc = x0; | 356 Register argc = x0; |
| 357 Register constructor = x1; | 357 Register constructor = x1; |
| 358 Register allocation_site = x2; | 358 Register allocation_site = x2; |
| 359 Register original_constructor = x3; | 359 Register new_target = x3; |
| 360 | 360 |
| 361 // Preserve the incoming parameters on the stack. | 361 // Preserve the incoming parameters on the stack. |
| 362 __ AssertUndefinedOrAllocationSite(allocation_site, x10); | 362 __ AssertUndefinedOrAllocationSite(allocation_site, x10); |
| 363 __ SmiTag(argc); | 363 __ SmiTag(argc); |
| 364 __ Push(allocation_site, argc, constructor, original_constructor); | 364 __ Push(allocation_site, argc, constructor, new_target); |
| 365 // sp[0]: new.target | 365 // sp[0]: new.target |
| 366 // sp[1]: Constructor function. | 366 // sp[1]: Constructor function. |
| 367 // sp[2]: number of arguments (smi-tagged) | 367 // sp[2]: number of arguments (smi-tagged) |
| 368 // sp[3]: allocation site | 368 // sp[3]: allocation site |
| 369 | 369 |
| 370 // Try to allocate the object without transitioning into C code. If any of | 370 // Try to allocate the object without transitioning into C code. If any of |
| 371 // the preconditions is not met, the code bails out to the runtime call. | 371 // the preconditions is not met, the code bails out to the runtime call. |
| 372 Label rt_call, allocated; | 372 Label rt_call, allocated; |
| 373 if (FLAG_inline_new) { | 373 if (FLAG_inline_new) { |
| 374 ExternalReference debug_step_in_fp = | 374 ExternalReference debug_step_in_fp = |
| 375 ExternalReference::debug_step_in_fp_address(isolate); | 375 ExternalReference::debug_step_in_fp_address(isolate); |
| 376 __ Mov(x2, Operand(debug_step_in_fp)); | 376 __ Mov(x2, Operand(debug_step_in_fp)); |
| 377 __ Ldr(x2, MemOperand(x2)); | 377 __ Ldr(x2, MemOperand(x2)); |
| 378 __ Cbnz(x2, &rt_call); | 378 __ Cbnz(x2, &rt_call); |
| 379 | 379 |
| 380 // Verify that the original constructor is a JSFunction. | 380 // Verify that the new target is a JSFunction. |
| 381 __ JumpIfNotObjectType(original_constructor, x10, x11, JS_FUNCTION_TYPE, | 381 __ JumpIfNotObjectType(new_target, x10, x11, JS_FUNCTION_TYPE, &rt_call); |
| 382 &rt_call); | |
| 383 | 382 |
| 384 // Load the initial map and verify that it is in fact a map. | 383 // Load the initial map and verify that it is in fact a map. |
| 385 Register init_map = x2; | 384 Register init_map = x2; |
| 386 __ Ldr(init_map, | 385 __ Ldr(init_map, |
| 387 FieldMemOperand(original_constructor, | 386 FieldMemOperand(new_target, |
| 388 JSFunction::kPrototypeOrInitialMapOffset)); | 387 JSFunction::kPrototypeOrInitialMapOffset)); |
| 389 __ JumpIfSmi(init_map, &rt_call); | 388 __ JumpIfSmi(init_map, &rt_call); |
| 390 __ JumpIfNotObjectType(init_map, x10, x11, MAP_TYPE, &rt_call); | 389 __ JumpIfNotObjectType(init_map, x10, x11, MAP_TYPE, &rt_call); |
| 391 | 390 |
| 392 // Fall back to runtime if the expected base constructor and base | 391 // Fall back to runtime if the expected base constructor and base |
| 393 // constructor differ. | 392 // constructor differ. |
| 394 __ Ldr(x10, | 393 __ Ldr(x10, |
| 395 FieldMemOperand(init_map, Map::kConstructorOrBackPointerOffset)); | 394 FieldMemOperand(init_map, Map::kConstructorOrBackPointerOffset)); |
| 396 __ Cmp(constructor, x10); | 395 __ Cmp(constructor, x10); |
| 397 __ B(ne, &rt_call); | 396 __ B(ne, &rt_call); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 first_prop = NoReg; | 508 first_prop = NoReg; |
| 510 prop_fields = NoReg; | 509 prop_fields = NoReg; |
| 511 | 510 |
| 512 // Add the object tag to make the JSObject real, so that we can continue | 511 // Add the object tag to make the JSObject real, so that we can continue |
| 513 // and jump into the continuation code at any time from now on. | 512 // and jump into the continuation code at any time from now on. |
| 514 __ Add(new_obj, new_obj, kHeapObjectTag); | 513 __ Add(new_obj, new_obj, kHeapObjectTag); |
| 515 | 514 |
| 516 // Continue with JSObject being successfully allocated. | 515 // Continue with JSObject being successfully allocated. |
| 517 __ B(&allocated); | 516 __ B(&allocated); |
| 518 | 517 |
| 519 // Reload the original constructor and fall-through. | 518 // Reload the new target and fall-through. |
| 520 __ Bind(&rt_call_reload_new_target); | 519 __ Bind(&rt_call_reload_new_target); |
| 521 __ Peek(x3, 0 * kXRegSize); | 520 __ Peek(x3, 0 * kXRegSize); |
| 522 } | 521 } |
| 523 | 522 |
| 524 // Allocate the new receiver object using the runtime call. | 523 // Allocate the new receiver object using the runtime call. |
| 525 // x1: constructor function | 524 // x1: constructor function |
| 526 // x3: original constructor | 525 // x3: new target |
| 527 __ Bind(&rt_call); | 526 __ Bind(&rt_call); |
| 528 __ Push(constructor, original_constructor); // arguments 1-2 | 527 __ Push(constructor, new_target); // arguments 1-2 |
| 529 __ CallRuntime(Runtime::kNewObject, 2); | 528 __ CallRuntime(Runtime::kNewObject, 2); |
| 530 __ Mov(x4, x0); | 529 __ Mov(x4, x0); |
| 531 | 530 |
| 532 // Receiver for constructor call allocated. | 531 // Receiver for constructor call allocated. |
| 533 // x4: JSObject | 532 // x4: JSObject |
| 534 __ Bind(&allocated); | 533 __ Bind(&allocated); |
| 535 | 534 |
| 536 // Restore the parameters. | 535 // Restore the parameters. |
| 537 __ Pop(original_constructor); | 536 __ Pop(new_target); |
| 538 __ Pop(constructor); | 537 __ Pop(constructor); |
| 539 | 538 |
| 540 // Reload the number of arguments from the stack. | 539 // Reload the number of arguments from the stack. |
| 541 // Set it up in x0 for the function call below. | 540 // Set it up in x0 for the function call below. |
| 542 // jssp[0]: number of arguments (smi-tagged) | 541 // jssp[0]: number of arguments (smi-tagged) |
| 543 __ Peek(argc, 0); // Load number of arguments. | 542 __ Peek(argc, 0); // Load number of arguments. |
| 544 __ SmiUntag(argc); | 543 __ SmiUntag(argc); |
| 545 | 544 |
| 546 __ Push(original_constructor, x4, x4); | 545 __ Push(new_target, x4, x4); |
| 547 | 546 |
| 548 // Set up pointer to last argument. | 547 // Set up pointer to last argument. |
| 549 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); | 548 __ Add(x2, fp, StandardFrameConstants::kCallerSPOffset); |
| 550 | 549 |
| 551 // Copy arguments and receiver to the expression stack. | 550 // Copy arguments and receiver to the expression stack. |
| 552 // Copy 2 values every loop to use ldp/stp. | 551 // Copy 2 values every loop to use ldp/stp. |
| 553 // x0: number of arguments | 552 // x0: number of arguments |
| 554 // x1: constructor function | 553 // x1: constructor function |
| 555 // x2: address of last argument (caller sp) | 554 // x2: address of last argument (caller sp) |
| 556 // jssp[0]: receiver | 555 // jssp[0]: receiver |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 // Throw away the result of the constructor invocation and use the | 615 // Throw away the result of the constructor invocation and use the |
| 617 // on-stack receiver as the result. | 616 // on-stack receiver as the result. |
| 618 __ Bind(&use_receiver); | 617 __ Bind(&use_receiver); |
| 619 __ Peek(x0, 0); | 618 __ Peek(x0, 0); |
| 620 | 619 |
| 621 // Remove the receiver from the stack, remove caller arguments, and | 620 // Remove the receiver from the stack, remove caller arguments, and |
| 622 // return. | 621 // return. |
| 623 __ Bind(&exit); | 622 __ Bind(&exit); |
| 624 // x0: result | 623 // x0: result |
| 625 // jssp[0]: receiver (newly allocated object) | 624 // jssp[0]: receiver (newly allocated object) |
| 626 // jssp[1]: new.target (original constructor) | 625 // jssp[1]: new target |
| 627 // jssp[2]: number of arguments (smi-tagged) | 626 // jssp[2]: number of arguments (smi-tagged) |
| 628 __ Peek(x1, 2 * kXRegSize); | 627 __ Peek(x1, 2 * kXRegSize); |
| 629 | 628 |
| 630 // Leave construct frame. | 629 // Leave construct frame. |
| 631 } | 630 } |
| 632 | 631 |
| 633 __ DropBySMI(x1); | 632 __ DropBySMI(x1); |
| 634 __ Drop(1); | 633 __ Drop(1); |
| 635 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, x1, x2); | 634 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, x1, x2); |
| 636 __ Ret(); | 635 __ Ret(); |
| 637 } | 636 } |
| 638 | 637 |
| 639 | 638 |
| 640 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 639 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 641 Generate_JSConstructStubHelper(masm, false); | 640 Generate_JSConstructStubHelper(masm, false); |
| 642 } | 641 } |
| 643 | 642 |
| 644 | 643 |
| 645 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 644 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 646 Generate_JSConstructStubHelper(masm, true); | 645 Generate_JSConstructStubHelper(masm, true); |
| 647 } | 646 } |
| 648 | 647 |
| 649 | 648 |
| 650 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 649 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 651 // ----------- S t a t e ------------- | 650 // ----------- S t a t e ------------- |
| 652 // -- x0 : number of arguments | 651 // -- x0 : number of arguments |
| 653 // -- x1 : constructor function | 652 // -- x1 : constructor function |
| 654 // -- x2 : allocation site or undefined | 653 // -- x2 : allocation site or undefined |
| 655 // -- x3 : original constructor | 654 // -- x3 : new target |
| 656 // -- lr : return address | 655 // -- lr : return address |
| 657 // -- sp[...]: constructor arguments | 656 // -- sp[...]: constructor arguments |
| 658 // ----------------------------------- | 657 // ----------------------------------- |
| 659 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived"); | 658 ASM_LOCATION("Builtins::Generate_JSConstructStubForDerived"); |
| 660 | 659 |
| 661 { | 660 { |
| 662 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 661 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 663 | 662 |
| 664 __ AssertUndefinedOrAllocationSite(x2, x10); | 663 __ AssertUndefinedOrAllocationSite(x2, x10); |
| 665 __ Mov(x4, x0); | 664 __ Mov(x4, x0); |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1695 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| 1697 } | 1696 } |
| 1698 } | 1697 } |
| 1699 | 1698 |
| 1700 | 1699 |
| 1701 // static | 1700 // static |
| 1702 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { | 1701 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { |
| 1703 // ----------- S t a t e ------------- | 1702 // ----------- S t a t e ------------- |
| 1704 // -- x0 : the number of arguments (not including the receiver) | 1703 // -- x0 : the number of arguments (not including the receiver) |
| 1705 // -- x1 : the constructor to call (checked to be a JSFunction) | 1704 // -- x1 : the constructor to call (checked to be a JSFunction) |
| 1706 // -- x3 : the original constructor (checked to be a JSFunction) | 1705 // -- x3 : the new target (checked to be a JSFunction) |
| 1707 // ----------------------------------- | 1706 // ----------------------------------- |
| 1708 __ AssertFunction(x1); | 1707 __ AssertFunction(x1); |
| 1709 __ AssertFunction(x3); | 1708 __ AssertFunction(x3); |
| 1710 | 1709 |
| 1711 // Calling convention for function specific ConstructStubs require | 1710 // Calling convention for function specific ConstructStubs require |
| 1712 // x2 to contain either an AllocationSite or undefined. | 1711 // x2 to contain either an AllocationSite or undefined. |
| 1713 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); | 1712 __ LoadRoot(x2, Heap::kUndefinedValueRootIndex); |
| 1714 | 1713 |
| 1715 // Tail call to the function-specific construct stub (still in the caller | 1714 // Tail call to the function-specific construct stub (still in the caller |
| 1716 // context at this point). | 1715 // context at this point). |
| 1717 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 1716 __ Ldr(x4, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
| 1718 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); | 1717 __ Ldr(x4, FieldMemOperand(x4, SharedFunctionInfo::kConstructStubOffset)); |
| 1719 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); | 1718 __ Add(x4, x4, Code::kHeaderSize - kHeapObjectTag); |
| 1720 __ Br(x4); | 1719 __ Br(x4); |
| 1721 } | 1720 } |
| 1722 | 1721 |
| 1723 | 1722 |
| 1724 // static | 1723 // static |
| 1725 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1724 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1726 // ----------- S t a t e ------------- | 1725 // ----------- S t a t e ------------- |
| 1727 // -- x0 : the number of arguments (not including the receiver) | 1726 // -- x0 : the number of arguments (not including the receiver) |
| 1728 // -- x1 : the constructor to call (checked to be a JSFunctionProxy) | 1727 // -- x1 : the constructor to call (checked to be a JSFunctionProxy) |
| 1729 // -- x3 : the original constructor (either the same as the constructor or | 1728 // -- x3 : the new target (either the same as the constructor or |
| 1730 // the JSFunction on which new was invoked initially) | 1729 // the JSFunction on which new was invoked initially) |
| 1731 // ----------------------------------- | 1730 // ----------------------------------- |
| 1732 | 1731 |
| 1733 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1732 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1734 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset)); | 1733 __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset)); |
| 1735 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1734 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1736 } | 1735 } |
| 1737 | 1736 |
| 1738 | 1737 |
| 1739 // static | 1738 // static |
| 1740 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1739 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1741 // ----------- S t a t e ------------- | 1740 // ----------- S t a t e ------------- |
| 1742 // -- x0 : the number of arguments (not including the receiver) | 1741 // -- x0 : the number of arguments (not including the receiver) |
| 1743 // -- x1 : the constructor to call (can be any Object) | 1742 // -- x1 : the constructor to call (can be any Object) |
| 1744 // -- x3 : the original constructor (either the same as the constructor or | 1743 // -- x3 : the new target (either the same as the constructor or |
| 1745 // the JSFunction on which new was invoked initially) | 1744 // the JSFunction on which new was invoked initially) |
| 1746 // ----------------------------------- | 1745 // ----------------------------------- |
| 1747 | 1746 |
| 1748 // Check if target has a [[Construct]] internal method. | 1747 // Check if target has a [[Construct]] internal method. |
| 1749 Label non_constructor; | 1748 Label non_constructor; |
| 1750 __ JumpIfSmi(x1, &non_constructor); | 1749 __ JumpIfSmi(x1, &non_constructor); |
| 1751 __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); | 1750 __ Ldr(x4, FieldMemOperand(x1, HeapObject::kMapOffset)); |
| 1752 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); | 1751 __ Ldrb(x2, FieldMemOperand(x4, Map::kBitFieldOffset)); |
| 1753 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); | 1752 __ TestAndBranchIfAllClear(x2, 1 << Map::kIsConstructor, &non_constructor); |
| 1754 | 1753 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 | 1810 |
| 1812 // Call the target. | 1811 // Call the target. |
| 1813 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1812 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1814 } | 1813 } |
| 1815 | 1814 |
| 1816 | 1815 |
| 1817 // static | 1816 // static |
| 1818 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1817 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1819 // ----------- S t a t e ------------- | 1818 // ----------- S t a t e ------------- |
| 1820 // -- x0 : argument count (not including receiver) | 1819 // -- x0 : argument count (not including receiver) |
| 1821 // -- x3 : original constructor | 1820 // -- x3 : new target |
| 1822 // -- x1 : constructor to call | 1821 // -- x1 : constructor to call |
| 1823 // -- x2 : address of the first argument | 1822 // -- x2 : address of the first argument |
| 1824 // ----------------------------------- | 1823 // ----------------------------------- |
| 1825 | 1824 |
| 1826 // Find the address of the last argument. | 1825 // Find the address of the last argument. |
| 1827 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). | 1826 __ add(x5, x0, Operand(1)); // Add one for receiver (to be constructed). |
| 1828 __ lsl(x5, x5, kPointerSizeLog2); | 1827 __ lsl(x5, x5, kPointerSizeLog2); |
| 1829 | 1828 |
| 1830 // Set stack pointer and where to stop. | 1829 // Set stack pointer and where to stop. |
| 1831 __ Mov(x6, jssp); | 1830 __ Mov(x6, jssp); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 } | 2018 } |
| 2020 } | 2019 } |
| 2021 | 2020 |
| 2022 | 2021 |
| 2023 #undef __ | 2022 #undef __ |
| 2024 | 2023 |
| 2025 } // namespace internal | 2024 } // namespace internal |
| 2026 } // namespace v8 | 2025 } // namespace v8 |
| 2027 | 2026 |
| 2028 #endif // V8_TARGET_ARCH_ARM | 2027 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |