| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 218 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 // static | 223 // static |
| 224 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 224 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
| 225 // ----------- S t a t e ------------- | 225 // ----------- S t a t e ------------- |
| 226 // -- a0 : number of arguments | 226 // -- a0 : number of arguments |
| 227 // -- a1 : constructor function | 227 // -- a1 : constructor function |
| 228 // -- a3 : original constructor | 228 // -- a3 : new target |
| 229 // -- ra : return address | 229 // -- ra : return address |
| 230 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 230 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
| 231 // -- sp[argc * 4] : receiver | 231 // -- sp[argc * 4] : receiver |
| 232 // ----------------------------------- | 232 // ----------------------------------- |
| 233 | 233 |
| 234 // 1. Load the first argument into a0 and get rid of the rest (including the | 234 // 1. Load the first argument into a0 and get rid of the rest (including the |
| 235 // receiver). | 235 // receiver). |
| 236 { | 236 { |
| 237 Label no_arguments, done; | 237 Label no_arguments, done; |
| 238 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); | 238 __ Branch(USE_DELAY_SLOT, &no_arguments, eq, a0, Operand(zero_reg)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 260 FrameScope scope(masm, StackFrame::INTERNAL); | 260 FrameScope scope(masm, StackFrame::INTERNAL); |
| 261 ToStringStub stub(masm->isolate()); | 261 ToStringStub stub(masm->isolate()); |
| 262 __ Push(a1, a3); | 262 __ Push(a1, a3); |
| 263 __ CallStub(&stub); | 263 __ CallStub(&stub); |
| 264 __ Move(a0, v0); | 264 __ Move(a0, v0); |
| 265 __ Pop(a1, a3); | 265 __ Pop(a1, a3); |
| 266 } | 266 } |
| 267 __ bind(&done_convert); | 267 __ bind(&done_convert); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // 3. Check if original constructor and constructor differ. | 270 // 3. Check if new target and constructor differ. |
| 271 Label new_object; | 271 Label new_object; |
| 272 __ Branch(&new_object, ne, a1, Operand(a3)); | 272 __ Branch(&new_object, ne, a1, Operand(a3)); |
| 273 | 273 |
| 274 // 4. Allocate a JSValue wrapper for the string. | 274 // 4. Allocate a JSValue wrapper for the string. |
| 275 { | 275 { |
| 276 // ----------- S t a t e ------------- | 276 // ----------- S t a t e ------------- |
| 277 // -- a0 : the first argument | 277 // -- a0 : the first argument |
| 278 // -- a1 : constructor function | 278 // -- a1 : constructor function |
| 279 // -- a3 : original constructor | 279 // -- a3 : new target |
| 280 // -- ra : return address | 280 // -- ra : return address |
| 281 // ----------------------------------- | 281 // ----------------------------------- |
| 282 __ Allocate(JSValue::kSize, v0, a2, t0, &new_object, TAG_OBJECT); | 282 __ Allocate(JSValue::kSize, v0, a2, t0, &new_object, TAG_OBJECT); |
| 283 | 283 |
| 284 // Initialize the JSValue in eax. | 284 // Initialize the JSValue in eax. |
| 285 __ LoadGlobalFunctionInitialMap(a1, a2, a3); | 285 __ LoadGlobalFunctionInitialMap(a1, a2, a3); |
| 286 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | 286 __ sw(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); |
| 287 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); | 287 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); |
| 288 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 288 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
| 289 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); | 289 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); |
| 290 __ Ret(USE_DELAY_SLOT); | 290 __ Ret(USE_DELAY_SLOT); |
| 291 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); | 291 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); |
| 292 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 292 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 293 } | 293 } |
| 294 | 294 |
| 295 // 5. Fallback to the runtime to create new object. | 295 // 5. Fallback to the runtime to create new object. |
| 296 __ bind(&new_object); | 296 __ bind(&new_object); |
| 297 { | 297 { |
| 298 FrameScope scope(masm, StackFrame::INTERNAL); | 298 FrameScope scope(masm, StackFrame::INTERNAL); |
| 299 __ Push(a0, a1, a3); // first argument, constructor, original constructor | 299 __ Push(a0, a1, a3); // first argument, constructor, new target |
| 300 __ CallRuntime(Runtime::kNewObject, 2); | 300 __ CallRuntime(Runtime::kNewObject, 2); |
| 301 __ Pop(a0); | 301 __ Pop(a0); |
| 302 } | 302 } |
| 303 __ Ret(USE_DELAY_SLOT); | 303 __ Ret(USE_DELAY_SLOT); |
| 304 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); | 304 __ sw(a0, FieldMemOperand(v0, JSValue::kValueOffset)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 | 307 |
| 308 static void CallRuntimePassFunction( | 308 static void CallRuntimePassFunction( |
| 309 MacroAssembler* masm, Runtime::FunctionId function_id) { | 309 MacroAssembler* masm, Runtime::FunctionId function_id) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 GenerateTailCallToSharedCode(masm); | 349 GenerateTailCallToSharedCode(masm); |
| 350 } | 350 } |
| 351 | 351 |
| 352 | 352 |
| 353 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 353 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 354 bool is_api_function) { | 354 bool is_api_function) { |
| 355 // ----------- S t a t e ------------- | 355 // ----------- S t a t e ------------- |
| 356 // -- a0 : number of arguments | 356 // -- a0 : number of arguments |
| 357 // -- a1 : constructor function | 357 // -- a1 : constructor function |
| 358 // -- a2 : allocation site or undefined | 358 // -- a2 : allocation site or undefined |
| 359 // -- a3 : original constructor | 359 // -- a3 : new target |
| 360 // -- ra : return address | 360 // -- ra : return address |
| 361 // -- sp[...]: constructor arguments | 361 // -- sp[...]: constructor arguments |
| 362 // ----------------------------------- | 362 // ----------------------------------- |
| 363 | 363 |
| 364 Isolate* isolate = masm->isolate(); | 364 Isolate* isolate = masm->isolate(); |
| 365 | 365 |
| 366 // Enter a construct frame. | 366 // Enter a construct frame. |
| 367 { | 367 { |
| 368 FrameScope scope(masm, StackFrame::CONSTRUCT); | 368 FrameScope scope(masm, StackFrame::CONSTRUCT); |
| 369 | 369 |
| 370 // Preserve the incoming parameters on the stack. | 370 // Preserve the incoming parameters on the stack. |
| 371 __ AssertUndefinedOrAllocationSite(a2, t0); | 371 __ AssertUndefinedOrAllocationSite(a2, t0); |
| 372 __ SmiTag(a0); | 372 __ SmiTag(a0); |
| 373 __ Push(a2, a0, a1, a3); | 373 __ Push(a2, a0, a1, a3); |
| 374 | 374 |
| 375 // Try to allocate the object without transitioning into C code. If any of | 375 // Try to allocate the object without transitioning into C code. If any of |
| 376 // the preconditions is not met, the code bails out to the runtime call. | 376 // the preconditions is not met, the code bails out to the runtime call. |
| 377 Label rt_call, allocated; | 377 Label rt_call, allocated; |
| 378 if (FLAG_inline_new) { | 378 if (FLAG_inline_new) { |
| 379 ExternalReference debug_step_in_fp = | 379 ExternalReference debug_step_in_fp = |
| 380 ExternalReference::debug_step_in_fp_address(isolate); | 380 ExternalReference::debug_step_in_fp_address(isolate); |
| 381 __ li(a2, Operand(debug_step_in_fp)); | 381 __ li(a2, Operand(debug_step_in_fp)); |
| 382 __ lw(a2, MemOperand(a2)); | 382 __ lw(a2, MemOperand(a2)); |
| 383 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); | 383 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); |
| 384 | 384 |
| 385 // Verify that the original constructor is a JSFunction. | 385 // Verify that the new target is a JSFunction. |
| 386 __ GetObjectType(a3, t1, t0); | 386 __ GetObjectType(a3, t1, t0); |
| 387 __ Branch(&rt_call, ne, t0, Operand(JS_FUNCTION_TYPE)); | 387 __ Branch(&rt_call, ne, t0, Operand(JS_FUNCTION_TYPE)); |
| 388 | 388 |
| 389 // Load the initial map and verify that it is in fact a map. | 389 // Load the initial map and verify that it is in fact a map. |
| 390 // a3: original constructor | 390 // a3: new target |
| 391 __ lw(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset)); | 391 __ lw(a2, FieldMemOperand(a3, JSFunction::kPrototypeOrInitialMapOffset)); |
| 392 __ JumpIfSmi(a2, &rt_call); | 392 __ JumpIfSmi(a2, &rt_call); |
| 393 __ GetObjectType(a2, t5, t4); | 393 __ GetObjectType(a2, t5, t4); |
| 394 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); | 394 __ Branch(&rt_call, ne, t4, Operand(MAP_TYPE)); |
| 395 | 395 |
| 396 // Fall back to runtime if the expected base constructor and base | 396 // Fall back to runtime if the expected base constructor and base |
| 397 // constructor differ. | 397 // constructor differ. |
| 398 __ lw(t1, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); | 398 __ lw(t1, FieldMemOperand(a2, Map::kConstructorOrBackPointerOffset)); |
| 399 __ Branch(&rt_call, ne, a1, Operand(t1)); | 399 __ Branch(&rt_call, ne, a1, Operand(t1)); |
| 400 | 400 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 __ InitializeFieldsWithFiller(t5, a0, t7); | 500 __ InitializeFieldsWithFiller(t5, a0, t7); |
| 501 | 501 |
| 502 // Add the object tag to make the JSObject real, so that we can continue | 502 // Add the object tag to make the JSObject real, so that we can continue |
| 503 // and jump into the continuation code at any time from now on. | 503 // and jump into the continuation code at any time from now on. |
| 504 __ Addu(t4, t4, Operand(kHeapObjectTag)); | 504 __ Addu(t4, t4, Operand(kHeapObjectTag)); |
| 505 | 505 |
| 506 // Continue with JSObject being successfully allocated. | 506 // Continue with JSObject being successfully allocated. |
| 507 // t4: JSObject | 507 // t4: JSObject |
| 508 __ jmp(&allocated); | 508 __ jmp(&allocated); |
| 509 | 509 |
| 510 // Reload the original constructor and fall-through. | 510 // Reload the new target and fall-through. |
| 511 __ bind(&rt_call_reload_new_target); | 511 __ bind(&rt_call_reload_new_target); |
| 512 __ lw(a3, MemOperand(sp, 0 * kPointerSize)); | 512 __ lw(a3, MemOperand(sp, 0 * kPointerSize)); |
| 513 } | 513 } |
| 514 | 514 |
| 515 // Allocate the new receiver object using the runtime call. | 515 // Allocate the new receiver object using the runtime call. |
| 516 // a1: constructor function | 516 // a1: constructor function |
| 517 // a3: original constructor | 517 // a3: new target |
| 518 __ bind(&rt_call); | 518 __ bind(&rt_call); |
| 519 | 519 |
| 520 __ Push(a1, a3); // constructor function, original constructor | 520 __ Push(a1, a3); // constructor function, new target |
| 521 __ CallRuntime(Runtime::kNewObject, 2); | 521 __ CallRuntime(Runtime::kNewObject, 2); |
| 522 __ mov(t4, v0); | 522 __ mov(t4, v0); |
| 523 | 523 |
| 524 // Receiver for constructor call allocated. | 524 // Receiver for constructor call allocated. |
| 525 // t4: JSObject | 525 // t4: JSObject |
| 526 __ bind(&allocated); | 526 __ bind(&allocated); |
| 527 | 527 |
| 528 // Restore the parameters. | 528 // Restore the parameters. |
| 529 __ Pop(a3); // new.target | 529 __ Pop(a3); // new.target |
| 530 __ Pop(a1); | 530 __ Pop(a1); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 // Throw away the result of the constructor invocation and use the | 600 // Throw away the result of the constructor invocation and use the |
| 601 // on-stack receiver as the result. | 601 // on-stack receiver as the result. |
| 602 __ bind(&use_receiver); | 602 __ bind(&use_receiver); |
| 603 __ lw(v0, MemOperand(sp)); | 603 __ lw(v0, MemOperand(sp)); |
| 604 | 604 |
| 605 // Remove receiver from the stack, remove caller arguments, and | 605 // Remove receiver from the stack, remove caller arguments, and |
| 606 // return. | 606 // return. |
| 607 __ bind(&exit); | 607 __ bind(&exit); |
| 608 // v0: result | 608 // v0: result |
| 609 // sp[0]: receiver (newly allocated object) | 609 // sp[0]: receiver (newly allocated object) |
| 610 // sp[1]: new.target (original constructor) | 610 // sp[1]: new target |
| 611 // sp[2]: number of arguments (smi-tagged) | 611 // sp[2]: number of arguments (smi-tagged) |
| 612 __ lw(a1, MemOperand(sp, 2 * kPointerSize)); | 612 __ lw(a1, MemOperand(sp, 2 * kPointerSize)); |
| 613 | 613 |
| 614 // Leave construct frame. | 614 // Leave construct frame. |
| 615 } | 615 } |
| 616 | 616 |
| 617 __ sll(t0, a1, kPointerSizeLog2 - 1); | 617 __ sll(t0, a1, kPointerSizeLog2 - 1); |
| 618 __ Addu(sp, sp, t0); | 618 __ Addu(sp, sp, t0); |
| 619 __ Addu(sp, sp, kPointerSize); | 619 __ Addu(sp, sp, kPointerSize); |
| 620 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); | 620 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); |
| 621 __ Ret(); | 621 __ Ret(); |
| 622 } | 622 } |
| 623 | 623 |
| 624 | 624 |
| 625 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 625 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 626 Generate_JSConstructStubHelper(masm, false); | 626 Generate_JSConstructStubHelper(masm, false); |
| 627 } | 627 } |
| 628 | 628 |
| 629 | 629 |
| 630 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 630 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 631 Generate_JSConstructStubHelper(masm, true); | 631 Generate_JSConstructStubHelper(masm, true); |
| 632 } | 632 } |
| 633 | 633 |
| 634 | 634 |
| 635 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 635 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 636 // ----------- S t a t e ------------- | 636 // ----------- S t a t e ------------- |
| 637 // -- a0 : number of arguments | 637 // -- a0 : number of arguments |
| 638 // -- a1 : constructor function | 638 // -- a1 : constructor function |
| 639 // -- a2 : allocation site or undefined | 639 // -- a2 : allocation site or undefined |
| 640 // -- a3 : original constructor | 640 // -- a3 : new target |
| 641 // -- ra : return address | 641 // -- ra : return address |
| 642 // -- sp[...]: constructor arguments | 642 // -- sp[...]: constructor arguments |
| 643 // ----------------------------------- | 643 // ----------------------------------- |
| 644 | 644 |
| 645 { | 645 { |
| 646 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 646 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 647 | 647 |
| 648 __ AssertUndefinedOrAllocationSite(a2, t0); | 648 __ AssertUndefinedOrAllocationSite(a2, t0); |
| 649 __ push(a2); | 649 __ push(a2); |
| 650 | 650 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 1000 |
| 1001 // Call the target. | 1001 // Call the target. |
| 1002 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1002 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 | 1005 |
| 1006 // static | 1006 // static |
| 1007 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1007 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1008 // ----------- S t a t e ------------- | 1008 // ----------- S t a t e ------------- |
| 1009 // -- a0 : argument count (not including receiver) | 1009 // -- a0 : argument count (not including receiver) |
| 1010 // -- a3 : original constructor | 1010 // -- a3 : new target |
| 1011 // -- a1 : constructor to call | 1011 // -- a1 : constructor to call |
| 1012 // -- a2 : address of the first argument | 1012 // -- a2 : address of the first argument |
| 1013 // ----------------------------------- | 1013 // ----------------------------------- |
| 1014 | 1014 |
| 1015 // Find the address of the last argument. | 1015 // Find the address of the last argument. |
| 1016 __ sll(t0, a0, kPointerSizeLog2); | 1016 __ sll(t0, a0, kPointerSizeLog2); |
| 1017 __ Subu(t0, a2, Operand(t0)); | 1017 __ Subu(t0, a2, Operand(t0)); |
| 1018 | 1018 |
| 1019 // Push a slot for the receiver. | 1019 // Push a slot for the receiver. |
| 1020 __ push(zero_reg); | 1020 __ push(zero_reg); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1715 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| 1716 } | 1716 } |
| 1717 } | 1717 } |
| 1718 | 1718 |
| 1719 | 1719 |
| 1720 // static | 1720 // static |
| 1721 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { | 1721 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { |
| 1722 // ----------- S t a t e ------------- | 1722 // ----------- S t a t e ------------- |
| 1723 // -- a0 : the number of arguments (not including the receiver) | 1723 // -- a0 : the number of arguments (not including the receiver) |
| 1724 // -- a1 : the constructor to call (checked to be a JSFunction) | 1724 // -- a1 : the constructor to call (checked to be a JSFunction) |
| 1725 // -- a3 : the original constructor (checked to be a JSFunction) | 1725 // -- a3 : the new target (checked to be a JSFunction) |
| 1726 // ----------------------------------- | 1726 // ----------------------------------- |
| 1727 __ AssertFunction(a1); | 1727 __ AssertFunction(a1); |
| 1728 __ AssertFunction(a3); | 1728 __ AssertFunction(a3); |
| 1729 | 1729 |
| 1730 // Calling convention for function specific ConstructStubs require | 1730 // Calling convention for function specific ConstructStubs require |
| 1731 // a2 to contain either an AllocationSite or undefined. | 1731 // a2 to contain either an AllocationSite or undefined. |
| 1732 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 1732 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 1733 | 1733 |
| 1734 // Tail call to the function-specific construct stub (still in the caller | 1734 // Tail call to the function-specific construct stub (still in the caller |
| 1735 // context at this point). | 1735 // context at this point). |
| 1736 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1736 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1737 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); | 1737 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
| 1738 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1738 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1739 __ Jump(at); | 1739 __ Jump(at); |
| 1740 } | 1740 } |
| 1741 | 1741 |
| 1742 | 1742 |
| 1743 // static | 1743 // static |
| 1744 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1744 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1745 // ----------- S t a t e ------------- | 1745 // ----------- S t a t e ------------- |
| 1746 // -- a0 : the number of arguments (not including the receiver) | 1746 // -- a0 : the number of arguments (not including the receiver) |
| 1747 // -- a1 : the constructor to call (checked to be a JSFunctionProxy) | 1747 // -- a1 : the constructor to call (checked to be a JSFunctionProxy) |
| 1748 // -- a3 : the original constructor (either the same as the constructor or | 1748 // -- a3 : the new target (either the same as the constructor or |
| 1749 // the JSFunction on which new was invoked initially) | 1749 // the JSFunction on which new was invoked initially) |
| 1750 // ----------------------------------- | 1750 // ----------------------------------- |
| 1751 | 1751 |
| 1752 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1752 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1753 __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); | 1753 __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); |
| 1754 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1754 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 | 1757 |
| 1758 // static | 1758 // static |
| 1759 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1759 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1760 // ----------- S t a t e ------------- | 1760 // ----------- S t a t e ------------- |
| 1761 // -- a0 : the number of arguments (not including the receiver) | 1761 // -- a0 : the number of arguments (not including the receiver) |
| 1762 // -- a1 : the constructor to call (can be any Object) | 1762 // -- a1 : the constructor to call (can be any Object) |
| 1763 // -- a3 : the original constructor (either the same as the constructor or | 1763 // -- a3 : the new target (either the same as the constructor or |
| 1764 // the JSFunction on which new was invoked initially) | 1764 // the JSFunction on which new was invoked initially) |
| 1765 // ----------------------------------- | 1765 // ----------------------------------- |
| 1766 | 1766 |
| 1767 // Check if target has a [[Construct]] internal method. | 1767 // Check if target has a [[Construct]] internal method. |
| 1768 Label non_constructor; | 1768 Label non_constructor; |
| 1769 __ JumpIfSmi(a1, &non_constructor); | 1769 __ JumpIfSmi(a1, &non_constructor); |
| 1770 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1770 __ lw(t1, FieldMemOperand(a1, HeapObject::kMapOffset)); |
| 1771 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); | 1771 __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset)); |
| 1772 __ And(t2, t2, Operand(1 << Map::kIsCallable)); | 1772 __ And(t2, t2, Operand(1 << Map::kIsCallable)); |
| 1773 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); | 1773 __ Branch(&non_constructor, eq, t2, Operand(zero_reg)); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1954 } | 1954 } |
| 1955 } | 1955 } |
| 1956 | 1956 |
| 1957 | 1957 |
| 1958 #undef __ | 1958 #undef __ |
| 1959 | 1959 |
| 1960 } // namespace internal | 1960 } // namespace internal |
| 1961 } // namespace v8 | 1961 } // namespace v8 |
| 1962 | 1962 |
| 1963 #endif // V8_TARGET_ARCH_MIPS | 1963 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |