| OLD | NEW |
| 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/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 204 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 | 208 |
| 209 // static | 209 // static |
| 210 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 210 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
| 211 // ----------- S t a t e ------------- | 211 // ----------- S t a t e ------------- |
| 212 // -- r0 : number of arguments | 212 // -- r0 : number of arguments |
| 213 // -- r1 : constructor function | 213 // -- r1 : constructor function |
| 214 // -- r3 : original constructor | 214 // -- r3 : new target |
| 215 // -- lr : return address | 215 // -- lr : return address |
| 216 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 216 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
| 217 // -- sp[argc * 4] : receiver | 217 // -- sp[argc * 4] : receiver |
| 218 // ----------------------------------- | 218 // ----------------------------------- |
| 219 | 219 |
| 220 // 1. Load the first argument into r2 and get rid of the rest (including the | 220 // 1. Load the first argument into r2 and get rid of the rest (including the |
| 221 // receiver). | 221 // receiver). |
| 222 { | 222 { |
| 223 Label no_arguments, done; | 223 Label no_arguments, done; |
| 224 __ sub(r0, r0, Operand(1), SetCC); | 224 __ sub(r0, r0, Operand(1), SetCC); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 244 ToStringStub stub(masm->isolate()); | 244 ToStringStub stub(masm->isolate()); |
| 245 __ Push(r1, r3); | 245 __ Push(r1, r3); |
| 246 __ Move(r0, r2); | 246 __ Move(r0, r2); |
| 247 __ CallStub(&stub); | 247 __ CallStub(&stub); |
| 248 __ Move(r2, r0); | 248 __ Move(r2, r0); |
| 249 __ Pop(r1, r3); | 249 __ Pop(r1, r3); |
| 250 } | 250 } |
| 251 __ bind(&done_convert); | 251 __ bind(&done_convert); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // 3. Check if original constructor and constructor differ. | 254 // 3. Check if new target and constructor differ. |
| 255 Label new_object; | 255 Label new_object; |
| 256 __ cmp(r1, r3); | 256 __ cmp(r1, r3); |
| 257 __ b(ne, &new_object); | 257 __ b(ne, &new_object); |
| 258 | 258 |
| 259 // 4. Allocate a JSValue wrapper for the string. | 259 // 4. Allocate a JSValue wrapper for the string. |
| 260 { | 260 { |
| 261 // ----------- S t a t e ------------- | 261 // ----------- S t a t e ------------- |
| 262 // -- r2 : the first argument | 262 // -- r2 : the first argument |
| 263 // -- r1 : constructor function | 263 // -- r1 : constructor function |
| 264 // -- r3 : original constructor | 264 // -- r3 : new target |
| 265 // -- lr : return address | 265 // -- lr : return address |
| 266 // ----------------------------------- | 266 // ----------------------------------- |
| 267 __ Allocate(JSValue::kSize, r0, r4, r5, &new_object, TAG_OBJECT); | 267 __ Allocate(JSValue::kSize, r0, r4, r5, &new_object, TAG_OBJECT); |
| 268 | 268 |
| 269 // Initialize the JSValue in r0. | 269 // Initialize the JSValue in r0. |
| 270 __ LoadGlobalFunctionInitialMap(r1, r3, r4); | 270 __ LoadGlobalFunctionInitialMap(r1, r3, r4); |
| 271 __ str(r3, FieldMemOperand(r0, HeapObject::kMapOffset)); | 271 __ str(r3, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 272 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 272 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 273 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 273 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 274 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | 274 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 275 __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset)); | 275 __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset)); |
| 276 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 276 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 277 __ Ret(); | 277 __ Ret(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 // 5. Fallback to the runtime to create new object. | 280 // 5. Fallback to the runtime to create new object. |
| 281 __ bind(&new_object); | 281 __ bind(&new_object); |
| 282 { | 282 { |
| 283 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 283 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 284 __ Push(r2, r1, r3); // first argument, constructor, original constructor | 284 __ Push(r2, r1, r3); // first argument, constructor, new target |
| 285 __ CallRuntime(Runtime::kNewObject, 2); | 285 __ CallRuntime(Runtime::kNewObject, 2); |
| 286 __ Pop(r2); | 286 __ Pop(r2); |
| 287 } | 287 } |
| 288 __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset)); | 288 __ str(r2, FieldMemOperand(r0, JSValue::kValueOffset)); |
| 289 __ Ret(); | 289 __ Ret(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 static void CallRuntimePassFunction( | 293 static void CallRuntimePassFunction( |
| 294 MacroAssembler* masm, Runtime::FunctionId function_id) { | 294 MacroAssembler* masm, Runtime::FunctionId function_id) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 GenerateTailCallToSharedCode(masm); | 336 GenerateTailCallToSharedCode(masm); |
| 337 } | 337 } |
| 338 | 338 |
| 339 | 339 |
| 340 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 340 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 341 bool is_api_function) { | 341 bool is_api_function) { |
| 342 // ----------- S t a t e ------------- | 342 // ----------- S t a t e ------------- |
| 343 // -- r0 : number of arguments | 343 // -- r0 : number of arguments |
| 344 // -- r1 : constructor function | 344 // -- r1 : constructor function |
| 345 // -- r2 : allocation site or undefined | 345 // -- r2 : allocation site or undefined |
| 346 // -- r3 : original constructor | 346 // -- r3 : new target |
| 347 // -- lr : return address | 347 // -- lr : return address |
| 348 // -- sp[...]: constructor arguments | 348 // -- sp[...]: constructor arguments |
| 349 // ----------------------------------- | 349 // ----------------------------------- |
| 350 | 350 |
| 351 Isolate* isolate = masm->isolate(); | 351 Isolate* isolate = masm->isolate(); |
| 352 | 352 |
| 353 // Enter a construct frame. | 353 // Enter a construct frame. |
| 354 { | 354 { |
| 355 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 355 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
| 356 | 356 |
| 357 // Preserve the incoming parameters on the stack. | 357 // Preserve the incoming parameters on the stack. |
| 358 __ AssertUndefinedOrAllocationSite(r2, r4); | 358 __ AssertUndefinedOrAllocationSite(r2, r4); |
| 359 __ push(r2); | 359 __ push(r2); |
| 360 __ SmiTag(r0); | 360 __ SmiTag(r0); |
| 361 __ push(r0); | 361 __ push(r0); |
| 362 __ push(r1); | 362 __ push(r1); |
| 363 __ push(r3); | 363 __ push(r3); |
| 364 | 364 |
| 365 // Try to allocate the object without transitioning into C code. If any of | 365 // Try to allocate the object without transitioning into C code. If any of |
| 366 // the preconditions is not met, the code bails out to the runtime call. | 366 // the preconditions is not met, the code bails out to the runtime call. |
| 367 Label rt_call, allocated; | 367 Label rt_call, allocated; |
| 368 if (FLAG_inline_new) { | 368 if (FLAG_inline_new) { |
| 369 ExternalReference debug_step_in_fp = | 369 ExternalReference debug_step_in_fp = |
| 370 ExternalReference::debug_step_in_fp_address(isolate); | 370 ExternalReference::debug_step_in_fp_address(isolate); |
| 371 __ mov(r2, Operand(debug_step_in_fp)); | 371 __ mov(r2, Operand(debug_step_in_fp)); |
| 372 __ ldr(r2, MemOperand(r2)); | 372 __ ldr(r2, MemOperand(r2)); |
| 373 __ tst(r2, r2); | 373 __ tst(r2, r2); |
| 374 __ b(ne, &rt_call); | 374 __ b(ne, &rt_call); |
| 375 | 375 |
| 376 // Verify that the original constructor is a JSFunction. | 376 // Verify that the new target is a JSFunction. |
| 377 __ CompareObjectType(r3, r5, r4, JS_FUNCTION_TYPE); | 377 __ CompareObjectType(r3, r5, r4, JS_FUNCTION_TYPE); |
| 378 __ b(ne, &rt_call); | 378 __ b(ne, &rt_call); |
| 379 | 379 |
| 380 // Load the initial map and verify that it is in fact a map. | 380 // Load the initial map and verify that it is in fact a map. |
| 381 // r3: original constructor | 381 // r3: new target |
| 382 __ ldr(r2, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); | 382 __ ldr(r2, FieldMemOperand(r3, JSFunction::kPrototypeOrInitialMapOffset)); |
| 383 __ JumpIfSmi(r2, &rt_call); | 383 __ JumpIfSmi(r2, &rt_call); |
| 384 __ CompareObjectType(r2, r5, r4, MAP_TYPE); | 384 __ CompareObjectType(r2, r5, r4, MAP_TYPE); |
| 385 __ b(ne, &rt_call); | 385 __ b(ne, &rt_call); |
| 386 | 386 |
| 387 // Fall back to runtime if the expected base constructor and base | 387 // Fall back to runtime if the expected base constructor and base |
| 388 // constructor differ. | 388 // constructor differ. |
| 389 __ ldr(r5, FieldMemOperand(r2, Map::kConstructorOrBackPointerOffset)); | 389 __ ldr(r5, FieldMemOperand(r2, Map::kConstructorOrBackPointerOffset)); |
| 390 __ cmp(r1, r5); | 390 __ cmp(r1, r5); |
| 391 __ b(ne, &rt_call); | 391 __ b(ne, &rt_call); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 __ InitializeFieldsWithFiller(r5, r0, r6); | 492 __ InitializeFieldsWithFiller(r5, r0, r6); |
| 493 | 493 |
| 494 // Add the object tag to make the JSObject real, so that we can continue | 494 // Add the object tag to make the JSObject real, so that we can continue |
| 495 // and jump into the continuation code at any time from now on. | 495 // and jump into the continuation code at any time from now on. |
| 496 __ add(r4, r4, Operand(kHeapObjectTag)); | 496 __ add(r4, r4, Operand(kHeapObjectTag)); |
| 497 | 497 |
| 498 // Continue with JSObject being successfully allocated | 498 // Continue with JSObject being successfully allocated |
| 499 // r4: JSObject | 499 // r4: JSObject |
| 500 __ jmp(&allocated); | 500 __ jmp(&allocated); |
| 501 | 501 |
| 502 // Reload the original constructor and fall-through. | 502 // Reload the new target and fall-through. |
| 503 __ bind(&rt_call_reload_new_target); | 503 __ bind(&rt_call_reload_new_target); |
| 504 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); | 504 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); |
| 505 } | 505 } |
| 506 | 506 |
| 507 // Allocate the new receiver object using the runtime call. | 507 // Allocate the new receiver object using the runtime call. |
| 508 // r1: constructor function | 508 // r1: constructor function |
| 509 // r3: original constructor | 509 // r3: new target |
| 510 __ bind(&rt_call); | 510 __ bind(&rt_call); |
| 511 | 511 |
| 512 __ push(r1); // constructor function | 512 __ push(r1); // constructor function |
| 513 __ push(r3); // original constructor | 513 __ push(r3); // new target |
| 514 __ CallRuntime(Runtime::kNewObject, 2); | 514 __ CallRuntime(Runtime::kNewObject, 2); |
| 515 __ mov(r4, r0); | 515 __ mov(r4, r0); |
| 516 | 516 |
| 517 // Receiver for constructor call allocated. | 517 // Receiver for constructor call allocated. |
| 518 // r4: JSObject | 518 // r4: JSObject |
| 519 __ bind(&allocated); | 519 __ bind(&allocated); |
| 520 | 520 |
| 521 // Restore the parameters. | 521 // Restore the parameters. |
| 522 __ pop(r3); | 522 __ pop(r3); |
| 523 __ pop(r1); | 523 __ pop(r1); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 // Throw away the result of the constructor invocation and use the | 599 // Throw away the result of the constructor invocation and use the |
| 600 // on-stack receiver as the result. | 600 // on-stack receiver as the result. |
| 601 __ bind(&use_receiver); | 601 __ bind(&use_receiver); |
| 602 __ ldr(r0, MemOperand(sp)); | 602 __ ldr(r0, MemOperand(sp)); |
| 603 | 603 |
| 604 // Remove receiver from the stack, remove caller arguments, and | 604 // Remove receiver from the stack, remove caller arguments, and |
| 605 // return. | 605 // return. |
| 606 __ bind(&exit); | 606 __ bind(&exit); |
| 607 // r0: result | 607 // r0: result |
| 608 // sp[0]: receiver (newly allocated object) | 608 // sp[0]: receiver (newly allocated object) |
| 609 // sp[1]: new.target (original constructor) | 609 // sp[1]: new target |
| 610 // sp[2]: number of arguments (smi-tagged) | 610 // sp[2]: number of arguments (smi-tagged) |
| 611 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); | 611 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
| 612 | 612 |
| 613 // Leave construct frame. | 613 // Leave construct frame. |
| 614 } | 614 } |
| 615 | 615 |
| 616 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); | 616 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
| 617 __ add(sp, sp, Operand(kPointerSize)); | 617 __ add(sp, sp, Operand(kPointerSize)); |
| 618 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2); | 618 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r1, r2); |
| 619 __ Jump(lr); | 619 __ Jump(lr); |
| 620 } | 620 } |
| 621 | 621 |
| 622 | 622 |
| 623 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 623 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 624 Generate_JSConstructStubHelper(masm, false); | 624 Generate_JSConstructStubHelper(masm, false); |
| 625 } | 625 } |
| 626 | 626 |
| 627 | 627 |
| 628 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 628 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 629 Generate_JSConstructStubHelper(masm, true); | 629 Generate_JSConstructStubHelper(masm, true); |
| 630 } | 630 } |
| 631 | 631 |
| 632 | 632 |
| 633 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 633 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 634 // ----------- S t a t e ------------- | 634 // ----------- S t a t e ------------- |
| 635 // -- r0 : number of arguments | 635 // -- r0 : number of arguments |
| 636 // -- r1 : constructor function | 636 // -- r1 : constructor function |
| 637 // -- r2 : allocation site or undefined | 637 // -- r2 : allocation site or undefined |
| 638 // -- r3 : original constructor | 638 // -- r3 : new target |
| 639 // -- lr : return address | 639 // -- lr : return address |
| 640 // -- sp[...]: constructor arguments | 640 // -- sp[...]: constructor arguments |
| 641 // ----------------------------------- | 641 // ----------------------------------- |
| 642 | 642 |
| 643 { | 643 { |
| 644 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 644 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 645 | 645 |
| 646 __ AssertUndefinedOrAllocationSite(r2, r4); | 646 __ AssertUndefinedOrAllocationSite(r2, r4); |
| 647 __ push(r2); | 647 __ push(r2); |
| 648 | 648 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 | 1006 |
| 1007 // Call the target. | 1007 // Call the target. |
| 1008 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1008 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 | 1011 |
| 1012 // static | 1012 // static |
| 1013 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1013 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1014 // ----------- S t a t e ------------- | 1014 // ----------- S t a t e ------------- |
| 1015 // -- r0 : argument count (not including receiver) | 1015 // -- r0 : argument count (not including receiver) |
| 1016 // -- r3 : original constructor | 1016 // -- r3 : new target |
| 1017 // -- r1 : constructor to call | 1017 // -- r1 : constructor to call |
| 1018 // -- r2 : address of the first argument | 1018 // -- r2 : address of the first argument |
| 1019 // ----------------------------------- | 1019 // ----------------------------------- |
| 1020 | 1020 |
| 1021 // Find the address of the last argument. | 1021 // Find the address of the last argument. |
| 1022 __ mov(r4, Operand(r0, LSL, kPointerSizeLog2)); | 1022 __ mov(r4, Operand(r0, LSL, kPointerSizeLog2)); |
| 1023 __ sub(r4, r2, r4); | 1023 __ sub(r4, r2, r4); |
| 1024 | 1024 |
| 1025 // Push a slot for the receiver to be constructed. | 1025 // Push a slot for the receiver to be constructed. |
| 1026 __ push(r0); | 1026 __ push(r0); |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1699 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| 1700 } | 1700 } |
| 1701 } | 1701 } |
| 1702 | 1702 |
| 1703 | 1703 |
| 1704 // static | 1704 // static |
| 1705 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { | 1705 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { |
| 1706 // ----------- S t a t e ------------- | 1706 // ----------- S t a t e ------------- |
| 1707 // -- r0 : the number of arguments (not including the receiver) | 1707 // -- r0 : the number of arguments (not including the receiver) |
| 1708 // -- r1 : the constructor to call (checked to be a JSFunction) | 1708 // -- r1 : the constructor to call (checked to be a JSFunction) |
| 1709 // -- r3 : the original constructor (checked to be a JSFunction) | 1709 // -- r3 : the new target (checked to be a JSFunction) |
| 1710 // ----------------------------------- | 1710 // ----------------------------------- |
| 1711 __ AssertFunction(r1); | 1711 __ AssertFunction(r1); |
| 1712 __ AssertFunction(r3); | 1712 __ AssertFunction(r3); |
| 1713 | 1713 |
| 1714 // Calling convention for function specific ConstructStubs require | 1714 // Calling convention for function specific ConstructStubs require |
| 1715 // r2 to contain either an AllocationSite or undefined. | 1715 // r2 to contain either an AllocationSite or undefined. |
| 1716 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 1716 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 1717 | 1717 |
| 1718 // Tail call to the function-specific construct stub (still in the caller | 1718 // Tail call to the function-specific construct stub (still in the caller |
| 1719 // context at this point). | 1719 // context at this point). |
| 1720 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1720 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1721 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); | 1721 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kConstructStubOffset)); |
| 1722 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1722 __ add(pc, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1723 } | 1723 } |
| 1724 | 1724 |
| 1725 | 1725 |
| 1726 // static | 1726 // static |
| 1727 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1727 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1728 // ----------- S t a t e ------------- | 1728 // ----------- S t a t e ------------- |
| 1729 // -- r0 : the number of arguments (not including the receiver) | 1729 // -- r0 : the number of arguments (not including the receiver) |
| 1730 // -- r1 : the constructor to call (checked to be a JSFunctionProxy) | 1730 // -- r1 : the constructor to call (checked to be a JSFunctionProxy) |
| 1731 // -- r3 : the original constructor (either the same as the constructor or | 1731 // -- r3 : the new target (either the same as the constructor or |
| 1732 // the JSFunction on which new was invoked initially) | 1732 // the JSFunction on which new was invoked initially) |
| 1733 // ----------------------------------- | 1733 // ----------------------------------- |
| 1734 | 1734 |
| 1735 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1735 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1736 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset)); | 1736 __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset)); |
| 1737 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1737 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1738 } | 1738 } |
| 1739 | 1739 |
| 1740 | 1740 |
| 1741 // static | 1741 // static |
| 1742 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1742 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1743 // ----------- S t a t e ------------- | 1743 // ----------- S t a t e ------------- |
| 1744 // -- r0 : the number of arguments (not including the receiver) | 1744 // -- r0 : the number of arguments (not including the receiver) |
| 1745 // -- r1 : the constructor to call (can be any Object) | 1745 // -- r1 : the constructor to call (can be any Object) |
| 1746 // -- r3 : the original constructor (either the same as the constructor or | 1746 // -- r3 : the new target (either the same as the constructor or |
| 1747 // the JSFunction on which new was invoked initially) | 1747 // the JSFunction on which new was invoked initially) |
| 1748 // ----------------------------------- | 1748 // ----------------------------------- |
| 1749 | 1749 |
| 1750 // Check if target has a [[Construct]] internal method. | 1750 // Check if target has a [[Construct]] internal method. |
| 1751 Label non_constructor; | 1751 Label non_constructor; |
| 1752 __ JumpIfSmi(r1, &non_constructor); | 1752 __ JumpIfSmi(r1, &non_constructor); |
| 1753 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); | 1753 __ ldr(r4, FieldMemOperand(r1, HeapObject::kMapOffset)); |
| 1754 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); | 1754 __ ldrb(r2, FieldMemOperand(r4, Map::kBitFieldOffset)); |
| 1755 __ tst(r2, Operand(1 << Map::kIsConstructor)); | 1755 __ tst(r2, Operand(1 << Map::kIsConstructor)); |
| 1756 __ b(eq, &non_constructor); | 1756 __ b(eq, &non_constructor); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 } | 1927 } |
| 1928 } | 1928 } |
| 1929 | 1929 |
| 1930 | 1930 |
| 1931 #undef __ | 1931 #undef __ |
| 1932 | 1932 |
| 1933 } // namespace internal | 1933 } // namespace internal |
| 1934 } // namespace v8 | 1934 } // namespace v8 |
| 1935 | 1935 |
| 1936 #endif // V8_TARGET_ARCH_ARM | 1936 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |