| OLD | NEW | 
|---|
| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 548   Handle<Code> array_code = | 548   Handle<Code> array_code = | 
| 549       masm->isolate()->builtins()->ArrayCodeGeneric(); | 549       masm->isolate()->builtins()->ArrayCodeGeneric(); | 
| 550   __ Jump(array_code, RelocInfo::CODE_TARGET); | 550   __ Jump(array_code, RelocInfo::CODE_TARGET); | 
| 551 } | 551 } | 
| 552 | 552 | 
| 553 | 553 | 
| 554 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 554 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 
| 555   // ----------- S t a t e ------------- | 555   // ----------- S t a t e ------------- | 
| 556   //  -- a0     : number of arguments | 556   //  -- a0     : number of arguments | 
| 557   //  -- a1     : constructor function | 557   //  -- a1     : constructor function | 
|  | 558   //  -- a2     : type info cell | 
| 558   //  -- ra     : return address | 559   //  -- ra     : return address | 
| 559   //  -- sp[...]: constructor arguments | 560   //  -- sp[...]: constructor arguments | 
| 560   // ----------------------------------- | 561   // ----------------------------------- | 
| 561   Label generic_constructor; |  | 
| 562 | 562 | 
| 563   if (FLAG_debug_code) { | 563   if (FLAG_debug_code) { | 
| 564     // The array construct code is only set for the builtin and internal | 564     // The array construct code is only set for the builtin and internal | 
| 565     // Array functions which always have a map. | 565     // Array functions which always have a map. | 
| 566     // Initial map for the builtin Array function should be a map. | 566     // Initial map for the builtin Array function should be a map. | 
| 567     __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 567     __ lw(a3, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 
| 568     __ And(t0, a2, Operand(kSmiTagMask)); | 568     __ And(t0, a3, Operand(kSmiTagMask)); | 
| 569     __ Assert(ne, "Unexpected initial map for Array function (3)", | 569     __ Assert(ne, "Unexpected initial map for Array function (3)", | 
| 570               t0, Operand(zero_reg)); | 570               t0, Operand(zero_reg)); | 
| 571     __ GetObjectType(a2, a3, t0); | 571     __ GetObjectType(a1, a3, t0); | 
| 572     __ Assert(eq, "Unexpected initial map for Array function (4)", | 572     __ Assert(eq, "Unexpected initial map for Array function (4)", | 
| 573               t0, Operand(MAP_TYPE)); | 573               t0, Operand(MAP_TYPE)); | 
|  | 574 | 
|  | 575     // We should either have undefined in a2 or a valid jsglobalpropertycell | 
|  | 576     Label okay_here; | 
|  | 577     Handle<Object> undefined_sentinel( | 
|  | 578         masm->isolate()->heap()->undefined_value(), masm->isolate()); | 
|  | 579     Handle<Map> global_property_cell_map( | 
|  | 580         masm->isolate()->heap()->global_property_cell_map()); | 
|  | 581     __ Branch(&okay_here, eq, a2, Operand(undefined_sentinel)); | 
|  | 582     __ lw(a3, FieldMemOperand(a2, 0)); | 
|  | 583     __ Assert(eq, "Expected property cell in register a3", | 
|  | 584               a3, Operand(global_property_cell_map)); | 
|  | 585     __ bind(&okay_here); | 
| 574   } | 586   } | 
| 575 | 587 | 
| 576   // Run the native code for the Array function called as a constructor. | 588   if (FLAG_optimize_constructed_arrays) { | 
| 577   ArrayNativeCode(masm, &generic_constructor); | 589     Label not_zero_case, not_one_case; | 
|  | 590     __ Branch(¬_zero_case, ne, a0, Operand(zero_reg)); | 
|  | 591     ArrayNoArgumentConstructorStub no_argument_stub; | 
|  | 592     __ TailCallStub(&no_argument_stub); | 
| 578 | 593 | 
| 579   // Jump to the generic construct code in case the specialized code cannot | 594     __ bind(¬_zero_case); | 
| 580   // handle the construction. | 595     __ Branch(¬_one_case, gt, a0, Operand(1)); | 
| 581   __ bind(&generic_constructor); | 596     ArraySingleArgumentConstructorStub single_argument_stub; | 
|  | 597     __ TailCallStub(&single_argument_stub); | 
| 582 | 598 | 
| 583   Handle<Code> generic_construct_stub = | 599     __ bind(¬_one_case); | 
| 584       masm->isolate()->builtins()->JSConstructStubGeneric(); | 600     ArrayNArgumentsConstructorStub n_argument_stub; | 
| 585   __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 601     __ TailCallStub(&n_argument_stub); | 
|  | 602   } else { | 
|  | 603     Label generic_constructor; | 
|  | 604     // Run the native code for the Array function called as a constructor. | 
|  | 605     ArrayNativeCode(masm, &generic_constructor); | 
|  | 606 | 
|  | 607     // Jump to the generic construct code in case the specialized code cannot | 
|  | 608     // handle the construction. | 
|  | 609     __ bind(&generic_constructor); | 
|  | 610     Handle<Code> generic_construct_stub = | 
|  | 611         masm->isolate()->builtins()->JSConstructStubGeneric(); | 
|  | 612     __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 
|  | 613   } | 
| 586 } | 614 } | 
| 587 | 615 | 
| 588 | 616 | 
| 589 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 617 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 
| 590   // ----------- S t a t e ------------- | 618   // ----------- S t a t e ------------- | 
| 591   //  -- a0                     : number of arguments | 619   //  -- a0                     : number of arguments | 
| 592   //  -- a1                     : constructor function | 620   //  -- a1                     : constructor function | 
| 593   //  -- ra                     : return address | 621   //  -- ra                     : return address | 
| 594   //  -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 622   //  -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 
| 595   //  -- sp[argc * 4]           : receiver | 623   //  -- sp[argc * 4]           : receiver | 
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1164     __ mov(s2, t0); | 1192     __ mov(s2, t0); | 
| 1165     __ mov(s3, t0); | 1193     __ mov(s3, t0); | 
| 1166     __ mov(s4, t0); | 1194     __ mov(s4, t0); | 
| 1167     __ mov(s5, t0); | 1195     __ mov(s5, t0); | 
| 1168     // s6 holds the root address. Do not clobber. | 1196     // s6 holds the root address. Do not clobber. | 
| 1169     // s7 is cp. Do not init. | 1197     // s7 is cp. Do not init. | 
| 1170 | 1198 | 
| 1171     // Invoke the code and pass argc as a0. | 1199     // Invoke the code and pass argc as a0. | 
| 1172     __ mov(a0, a3); | 1200     __ mov(a0, a3); | 
| 1173     if (is_construct) { | 1201     if (is_construct) { | 
|  | 1202       // No type feedback cell is available | 
|  | 1203       Handle<Object> undefined_sentinel( | 
|  | 1204           masm->isolate()->heap()->undefined_value(), masm->isolate()); | 
|  | 1205       __ li(a2, Operand(undefined_sentinel)); | 
| 1174       CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 1206       CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 
| 1175       __ CallStub(&stub); | 1207       __ CallStub(&stub); | 
| 1176     } else { | 1208     } else { | 
| 1177       ParameterCount actual(a0); | 1209       ParameterCount actual(a0); | 
| 1178       __ InvokeFunction(a1, actual, CALL_FUNCTION, | 1210       __ InvokeFunction(a1, actual, CALL_FUNCTION, | 
| 1179                         NullCallWrapper(), CALL_AS_METHOD); | 1211                         NullCallWrapper(), CALL_AS_METHOD); | 
| 1180     } | 1212     } | 
| 1181 | 1213 | 
| 1182     // Leave internal frame. | 1214     // Leave internal frame. | 
| 1183   } | 1215   } | 
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1896   __ bind(&dont_adapt_arguments); | 1928   __ bind(&dont_adapt_arguments); | 
| 1897   __ Jump(a3); | 1929   __ Jump(a3); | 
| 1898 } | 1930 } | 
| 1899 | 1931 | 
| 1900 | 1932 | 
| 1901 #undef __ | 1933 #undef __ | 
| 1902 | 1934 | 
| 1903 } }  // namespace v8::internal | 1935 } }  // namespace v8::internal | 
| 1904 | 1936 | 
| 1905 #endif  // V8_TARGET_ARCH_MIPS | 1937 #endif  // V8_TARGET_ARCH_MIPS | 
| OLD | NEW | 
|---|