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

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 871693002: MIPS: new classes: change semantics of super(...) call and add new.target to construct stub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed nits. Created 5 years, 11 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/mips/full-codegen-mips.cc ('k') | src/mips64/code-stubs-mips64.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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 __ Branch(&ok, hs, sp, Operand(a4)); 307 __ Branch(&ok, hs, sp, Operand(a4));
308 308
309 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode); 309 CallRuntimePassFunction(masm, Runtime::kTryInstallOptimizedCode);
310 GenerateTailCallToReturnedCode(masm); 310 GenerateTailCallToReturnedCode(masm);
311 311
312 __ bind(&ok); 312 __ bind(&ok);
313 GenerateTailCallToSharedCode(masm); 313 GenerateTailCallToSharedCode(masm);
314 } 314 }
315 315
316 316
317 static void Generate_Runtime_NewObject(MacroAssembler* masm,
318 bool create_memento,
319 Register original_constructor,
320 Label* count_incremented,
321 Label* allocated) {
322 if (create_memento) {
323 // Get the cell or allocation site.
324 __ ld(a2, MemOperand(sp, 2 * kPointerSize));
325 __ push(a2);
326 }
327
328 __ push(a1); // argument for Runtime_NewObject
329 __ push(original_constructor); // original constructor
330 if (create_memento) {
331 __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 3);
332 } else {
333 __ CallRuntime(Runtime::kNewObject, 2);
334 }
335 __ mov(t0, v0);
336
337 // Runtime_NewObjectWithAllocationSite increments allocation count.
338 // Skip the increment.
339 if (create_memento) {
340 __ jmp(count_incremented);
341 } else {
342 __ jmp(allocated);
343 }
344 }
345
346
317 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 347 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
318 bool is_api_function, 348 bool is_api_function,
319 bool create_memento) { 349 bool create_memento) {
320 // ----------- S t a t e ------------- 350 // ----------- S t a t e -------------
321 // -- a0 : number of arguments 351 // -- a0 : number of arguments
322 // -- a1 : constructor function 352 // -- a1 : constructor function
323 // -- a2 : allocation site or undefined 353 // -- a2 : allocation site or undefined
354 // -- a3 : original constructor
324 // -- ra : return address 355 // -- ra : return address
325 // -- sp[...]: constructor arguments 356 // -- sp[...]: constructor arguments
326 // ----------------------------------- 357 // -----------------------------------
327 358
328 // Should never create mementos for api functions. 359 // Should never create mementos for api functions.
329 DCHECK(!is_api_function || !create_memento); 360 DCHECK(!is_api_function || !create_memento);
330 361
331 Isolate* isolate = masm->isolate(); 362 Isolate* isolate = masm->isolate();
332 363
333 // ----------- S t a t e ------------- 364 // ----------- S t a t e -------------
334 // -- a0 : number of arguments 365 // -- a0 : number of arguments
335 // -- a1 : constructor function 366 // -- a1 : constructor function
336 // -- ra : return address 367 // -- ra : return address
337 // -- sp[...]: constructor arguments 368 // -- sp[...]: constructor arguments
338 // ----------------------------------- 369 // -----------------------------------
339 370
340 // Enter a construct frame. 371 // Enter a construct frame.
341 { 372 {
342 FrameScope scope(masm, StackFrame::CONSTRUCT); 373 FrameScope scope(masm, StackFrame::CONSTRUCT);
343 374
344 if (create_memento) { 375 if (create_memento) {
345 __ AssertUndefinedOrAllocationSite(a2, a3); 376 __ AssertUndefinedOrAllocationSite(a2, t0);
346 __ push(a2); 377 __ push(a2);
347 } 378 }
348 379
349 // Preserve the two incoming parameters on the stack. 380 // Preserve the two incoming parameters on the stack.
350 // Tag arguments count. 381 // Tag arguments count.
351 __ dsll32(a0, a0, 0); 382 __ dsll32(a0, a0, 0);
352 __ MultiPushReversed(a0.bit() | a1.bit()); 383 __ MultiPushReversed(a0.bit() | a1.bit());
353 384
354 Label rt_call, allocated; 385 Label rt_call, allocated, normal_new, count_incremented;
386 __ Branch(&normal_new, eq, a1, Operand(a3));
387
388 // Original constructor and function are different.
389 Generate_Runtime_NewObject(masm, create_memento, a3, &count_incremented,
390 &allocated);
391 __ bind(&normal_new);
392
355 // Try to allocate the object without transitioning into C code. If any of 393 // Try to allocate the object without transitioning into C code. If any of
356 // the preconditions is not met, the code bails out to the runtime call. 394 // the preconditions is not met, the code bails out to the runtime call.
357 if (FLAG_inline_new) { 395 if (FLAG_inline_new) {
358 Label undo_allocation; 396 Label undo_allocation;
359 ExternalReference debug_step_in_fp = 397 ExternalReference debug_step_in_fp =
360 ExternalReference::debug_step_in_fp_address(isolate); 398 ExternalReference::debug_step_in_fp_address(isolate);
361 __ li(a2, Operand(debug_step_in_fp)); 399 __ li(a2, Operand(debug_step_in_fp));
362 __ ld(a2, MemOperand(a2)); 400 __ ld(a2, MemOperand(a2));
363 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); 401 __ Branch(&rt_call, ne, a2, Operand(zero_reg));
364 402
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 // example, the map's unused properties potentially do not match the 628 // example, the map's unused properties potentially do not match the
591 // allocated objects unused properties. 629 // allocated objects unused properties.
592 // t0: JSObject (previous new top) 630 // t0: JSObject (previous new top)
593 __ bind(&undo_allocation); 631 __ bind(&undo_allocation);
594 __ UndoAllocationInNewSpace(t0, t1); 632 __ UndoAllocationInNewSpace(t0, t1);
595 } 633 }
596 634
597 // Allocate the new receiver object using the runtime call. 635 // Allocate the new receiver object using the runtime call.
598 // a1: constructor function 636 // a1: constructor function
599 __ bind(&rt_call); 637 __ bind(&rt_call);
600 if (create_memento) { 638 Generate_Runtime_NewObject(masm, create_memento, a1, &count_incremented,
601 // Get the cell or allocation site. 639 &allocated);
602 __ ld(a2, MemOperand(sp, 2 * kPointerSize));
603 __ push(a2);
604 }
605 640
606 __ push(a1); // Argument for Runtime_NewObject.
607 if (create_memento) {
608 __ CallRuntime(Runtime::kNewObjectWithAllocationSite, 2);
609 } else {
610 __ CallRuntime(Runtime::kNewObject, 1);
611 }
612 __ mov(t0, v0);
613
614 // If we ended up using the runtime, and we want a memento, then the
615 // runtime call made it for us, and we shouldn't do create count
616 // increment.
617 Label count_incremented;
618 if (create_memento) {
619 __ jmp(&count_incremented);
620 }
621 641
622 // Receiver for constructor call allocated. 642 // Receiver for constructor call allocated.
623 // t0: JSObject 643 // t0: JSObject
624 __ bind(&allocated); 644 __ bind(&allocated);
625 645
626 if (create_memento) { 646 if (create_memento) {
627 __ ld(a2, MemOperand(sp, kPointerSize * 2)); 647 __ ld(a2, MemOperand(sp, kPointerSize * 2));
628 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); 648 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex);
629 __ Branch(&count_incremented, eq, a2, Operand(t1)); 649 __ Branch(&count_incremented, eq, a2, Operand(t1));
630 // a2 is an AllocationSite. We are creating a memento from it, so we 650 // a2 is an AllocationSite. We are creating a memento from it, so we
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 __ break_(0xCC); 1596 __ break_(0xCC);
1577 } 1597 }
1578 } 1598 }
1579 1599
1580 1600
1581 #undef __ 1601 #undef __
1582 1602
1583 } } // namespace v8::internal 1603 } } // namespace v8::internal
1584 1604
1585 #endif // V8_TARGET_ARCH_MIPS64 1605 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/full-codegen-mips.cc ('k') | src/mips64/code-stubs-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698