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

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

Issue 16407004: MIPS: Adapt hydrogen-based Array constructor to also support InternalArray and function call versio… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/code-stubs-mips.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 __ And(t0, a2, Operand(kSmiTagMask)); 491 __ And(t0, a2, Operand(kSmiTagMask));
492 __ Assert(ne, "Unexpected initial map for InternalArray function", 492 __ Assert(ne, "Unexpected initial map for InternalArray function",
493 t0, Operand(zero_reg)); 493 t0, Operand(zero_reg));
494 __ GetObjectType(a2, a3, t0); 494 __ GetObjectType(a2, a3, t0);
495 __ Assert(eq, "Unexpected initial map for InternalArray function", 495 __ Assert(eq, "Unexpected initial map for InternalArray function",
496 t0, Operand(MAP_TYPE)); 496 t0, Operand(MAP_TYPE));
497 } 497 }
498 498
499 // Run the native code for the InternalArray function called as a normal 499 // Run the native code for the InternalArray function called as a normal
500 // function. 500 // function.
501 ArrayNativeCode(masm, &generic_array_code); 501 if (FLAG_optimize_constructed_arrays) {
502 // Tail call a stub.
503 InternalArrayConstructorStub stub(masm->isolate());
504 __ TailCallStub(&stub);
505 } else {
506 ArrayNativeCode(masm, &generic_array_code);
502 507
503 // Jump to the generic array code if the specialized code cannot handle the 508 // Jump to the generic array code if the specialized code cannot handle the
504 // construction. 509 // construction.
505 __ bind(&generic_array_code); 510 __ bind(&generic_array_code);
506 511 Handle<Code> array_code =
507 Handle<Code> array_code = 512 masm->isolate()->builtins()->InternalArrayCodeGeneric();
508 masm->isolate()->builtins()->InternalArrayCodeGeneric(); 513 __ Jump(array_code, RelocInfo::CODE_TARGET);
509 __ Jump(array_code, RelocInfo::CODE_TARGET); 514 }
510 } 515 }
511 516
512 517
513 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { 518 void Builtins::Generate_ArrayCode(MacroAssembler* masm) {
514 // ----------- S t a t e ------------- 519 // ----------- S t a t e -------------
515 // -- a0 : number of arguments 520 // -- a0 : number of arguments
516 // -- ra : return address 521 // -- ra : return address
517 // -- sp[...]: constructor arguments 522 // -- sp[...]: constructor arguments
518 // ----------------------------------- 523 // -----------------------------------
519 Label generic_array_code; 524 Label generic_array_code;
520 525
521 // Get the Array function. 526 // Get the Array function.
522 GenerateLoadArrayFunction(masm, a1); 527 GenerateLoadArrayFunction(masm, a1);
523 528
524 if (FLAG_debug_code) { 529 if (FLAG_debug_code) {
525 // Initial map for the builtin Array functions should be maps. 530 // Initial map for the builtin Array functions should be maps.
526 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); 531 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset));
527 __ And(t0, a2, Operand(kSmiTagMask)); 532 __ And(t0, a2, Operand(kSmiTagMask));
528 __ Assert(ne, "Unexpected initial map for Array function (1)", 533 __ Assert(ne, "Unexpected initial map for Array function (1)",
529 t0, Operand(zero_reg)); 534 t0, Operand(zero_reg));
530 __ GetObjectType(a2, a3, t0); 535 __ GetObjectType(a2, a3, t0);
531 __ Assert(eq, "Unexpected initial map for Array function (2)", 536 __ Assert(eq, "Unexpected initial map for Array function (2)",
532 t0, Operand(MAP_TYPE)); 537 t0, Operand(MAP_TYPE));
533 } 538 }
534 539
535 // Run the native code for the Array function called as a normal function. 540 // Run the native code for the Array function called as a normal function.
536 ArrayNativeCode(masm, &generic_array_code); 541 if (FLAG_optimize_constructed_arrays) {
542 // Tail call a stub.
543 Handle<Object> undefined_sentinel(
544 masm->isolate()->heap()->undefined_value(),
545 masm->isolate());
546 __ li(a2, Operand(undefined_sentinel));
547 ArrayConstructorStub stub(masm->isolate());
548 __ TailCallStub(&stub);
549 } else {
550 ArrayNativeCode(masm, &generic_array_code);
537 551
538 // Jump to the generic array code if the specialized code cannot handle 552 // Jump to the generic array code if the specialized code cannot handle
539 // the construction. 553 // the construction.
540 __ bind(&generic_array_code); 554 __ bind(&generic_array_code);
541 555 Handle<Code> array_code =
542 Handle<Code> array_code = 556 masm->isolate()->builtins()->ArrayCodeGeneric();
543 masm->isolate()->builtins()->ArrayCodeGeneric(); 557 __ Jump(array_code, RelocInfo::CODE_TARGET);
544 __ Jump(array_code, RelocInfo::CODE_TARGET); 558 }
545 } 559 }
546 560
547 561
548 void Builtins::Generate_CommonArrayConstructCode(MacroAssembler* masm) { 562 void Builtins::Generate_CommonArrayConstructCode(MacroAssembler* masm) {
549 // ----------- S t a t e ------------- 563 // ----------- S t a t e -------------
550 // -- a0 : number of arguments 564 // -- a0 : number of arguments
551 // -- a1 : constructor function 565 // -- a1 : constructor function
552 // -- a2 : type info cell 566 // -- a2 : type info cell
553 // -- ra : return address 567 // -- ra : return address
554 // -- sp[...]: constructor arguments 568 // -- sp[...]: constructor arguments
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 __ bind(&dont_adapt_arguments); 1935 __ bind(&dont_adapt_arguments);
1922 __ Jump(a3); 1936 __ Jump(a3);
1923 } 1937 }
1924 1938
1925 1939
1926 #undef __ 1940 #undef __
1927 1941
1928 } } // namespace v8::internal 1942 } } // namespace v8::internal
1929 1943
1930 #endif // V8_TARGET_ARCH_MIPS 1944 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698