| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 // -- r1 : constructor function | 544 // -- r1 : constructor function |
| 545 // -- r2 : type info cell | 545 // -- r2 : type info cell |
| 546 // -- lr : return address | 546 // -- lr : return address |
| 547 // -- sp[...]: constructor arguments | 547 // -- sp[...]: constructor arguments |
| 548 // ----------------------------------- | 548 // ----------------------------------- |
| 549 | 549 |
| 550 if (FLAG_debug_code) { | 550 if (FLAG_debug_code) { |
| 551 // The array construct code is only set for the builtin and internal | 551 // The array construct code is only set for the builtin and internal |
| 552 // Array functions which always have a map. | 552 // Array functions which always have a map. |
| 553 // Initial map for the builtin Array function should be a map. | 553 // Initial map for the builtin Array function should be a map. |
| 554 __ stop("oh god"); | |
| 555 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 554 __ ldr(r3, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 556 __ tst(r3, Operand(kSmiTagMask)); | 555 __ tst(r3, Operand(kSmiTagMask)); |
| 557 __ Assert(ne, "Unexpected initial map for Array function"); | 556 __ Assert(ne, "Unexpected initial map for Array function"); |
| 558 __ CompareObjectType(r1, r3, r4, MAP_TYPE); | 557 __ CompareObjectType(r1, r3, r4, MAP_TYPE); |
| 559 __ Assert(eq, "Unexpected initial map for Array function"); | 558 __ Assert(eq, "Unexpected initial map for Array function"); |
| 560 | 559 |
| 561 // We should either have undefined in r2 or a valid jsglobalpropertycell | 560 // We should either have undefined in r2 or a valid jsglobalpropertycell |
| 562 Label okay_here; | 561 Label okay_here; |
| 563 Handle<Object> undefined_sentinel( | 562 Handle<Object> undefined_sentinel( |
| 564 masm->isolate()->heap()->undefined_value()); | 563 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
| 565 Handle<Map> global_property_cell_map( | 564 Handle<Map> global_property_cell_map( |
| 566 masm->isolate()->heap()->global_property_cell_map()); | 565 masm->isolate()->heap()->global_property_cell_map()); |
| 567 __ cmp(r2, Operand(undefined_sentinel)); | 566 __ cmp(r2, Operand(undefined_sentinel)); |
| 568 __ b(eq, &okay_here); | 567 __ b(eq, &okay_here); |
| 569 __ ldr(r3, FieldMemOperand(r2, 0)); | 568 __ ldr(r3, FieldMemOperand(r2, 0)); |
| 570 __ cmp(r3, Operand(global_property_cell_map)); | 569 __ cmp(r3, Operand(global_property_cell_map)); |
| 571 __ Assert(eq, "Expected property cell in register ebx"); | 570 __ Assert(eq, "Expected property cell in register ebx"); |
| 572 __ bind(&okay_here); | 571 __ bind(&okay_here); |
| 573 } | 572 } |
| 574 | 573 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 596 // Jump to the generic construct code in case the specialized code cannot | 595 // Jump to the generic construct code in case the specialized code cannot |
| 597 // handle the construction. | 596 // handle the construction. |
| 598 __ bind(&generic_constructor); | 597 __ bind(&generic_constructor); |
| 599 Handle<Code> generic_construct_stub = | 598 Handle<Code> generic_construct_stub = |
| 600 masm->isolate()->builtins()->JSConstructStubGeneric(); | 599 masm->isolate()->builtins()->JSConstructStubGeneric(); |
| 601 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 600 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 602 } | 601 } |
| 603 } | 602 } |
| 604 | 603 |
| 605 | 604 |
| 606 void Builtins::Generate_InternalArrayConstructCode(MacroAssembler* masm) { | |
| 607 // ----------- S t a t e ------------- | |
| 608 // -- r0 : number of arguments | |
| 609 // -- r1 : constructor function | |
| 610 // -- lr : return address | |
| 611 // -- sp[...]: constructor arguments | |
| 612 // ----------------------------------- | |
| 613 Label generic_constructor; | |
| 614 | |
| 615 if (FLAG_debug_code) { | |
| 616 // The array construct code is only set for the builtin and internal | |
| 617 // Array functions which always have a map. | |
| 618 // Initial map for the builtin Array function should be a map. | |
| 619 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | |
| 620 __ tst(r2, Operand(kSmiTagMask)); | |
| 621 __ Assert(ne, "Unexpected initial map for Array function"); | |
| 622 __ CompareObjectType(r2, r3, r4, MAP_TYPE); | |
| 623 __ Assert(eq, "Unexpected initial map for Array function"); | |
| 624 } | |
| 625 | |
| 626 // Run the native code for the Array function called as a constructor. | |
| 627 ArrayNativeCode(masm, &generic_constructor); | |
| 628 | |
| 629 // Jump to the generic construct code in case the specialized code cannot | |
| 630 // handle the construction. | |
| 631 __ bind(&generic_constructor); | |
| 632 Handle<Code> generic_construct_stub = | |
| 633 masm->isolate()->builtins()->JSConstructStubGeneric(); | |
| 634 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | |
| 635 } | |
| 636 | |
| 637 | |
| 638 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 605 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 639 // ----------- S t a t e ------------- | 606 // ----------- S t a t e ------------- |
| 640 // -- r0 : number of arguments | 607 // -- r0 : number of arguments |
| 641 // -- r1 : constructor function | 608 // -- r1 : constructor function |
| 642 // -- lr : return address | 609 // -- lr : return address |
| 643 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 610 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
| 644 // -- sp[argc * 4] : receiver | 611 // -- sp[argc * 4] : receiver |
| 645 // ----------------------------------- | 612 // ----------------------------------- |
| 646 Counters* counters = masm->isolate()->counters(); | 613 Counters* counters = masm->isolate()->counters(); |
| 647 __ IncrementCounter(counters->string_ctor_calls(), 1, r2, r3); | 614 __ IncrementCounter(counters->string_ctor_calls(), 1, r2, r3); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 __ mov(r7, Operand(r4)); | 1168 __ mov(r7, Operand(r4)); |
| 1202 if (kR9Available == 1) { | 1169 if (kR9Available == 1) { |
| 1203 __ mov(r9, Operand(r4)); | 1170 __ mov(r9, Operand(r4)); |
| 1204 } | 1171 } |
| 1205 | 1172 |
| 1206 // Invoke the code and pass argc as r0. | 1173 // Invoke the code and pass argc as r0. |
| 1207 __ mov(r0, Operand(r3)); | 1174 __ mov(r0, Operand(r3)); |
| 1208 if (is_construct) { | 1175 if (is_construct) { |
| 1209 // No type feedback cell is available | 1176 // No type feedback cell is available |
| 1210 Handle<Object> undefined_sentinel( | 1177 Handle<Object> undefined_sentinel( |
| 1211 masm->isolate()->heap()->undefined_value()); | 1178 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
| 1212 __ mov(r2, Operand(undefined_sentinel)); | 1179 __ mov(r2, Operand(undefined_sentinel)); |
| 1213 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 1180 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| 1214 __ CallStub(&stub); | 1181 __ CallStub(&stub); |
| 1215 } else { | 1182 } else { |
| 1216 ParameterCount actual(r0); | 1183 ParameterCount actual(r0); |
| 1217 __ InvokeFunction(r1, actual, CALL_FUNCTION, | 1184 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 1218 NullCallWrapper(), CALL_AS_METHOD); | 1185 NullCallWrapper(), CALL_AS_METHOD); |
| 1219 } | 1186 } |
| 1220 // Exit the JS frame and remove the parameters (except function), and | 1187 // Exit the JS frame and remove the parameters (except function), and |
| 1221 // return. | 1188 // return. |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 __ bind(&dont_adapt_arguments); | 1886 __ bind(&dont_adapt_arguments); |
| 1920 __ Jump(r3); | 1887 __ Jump(r3); |
| 1921 } | 1888 } |
| 1922 | 1889 |
| 1923 | 1890 |
| 1924 #undef __ | 1891 #undef __ |
| 1925 | 1892 |
| 1926 } } // namespace v8::internal | 1893 } } // namespace v8::internal |
| 1927 | 1894 |
| 1928 #endif // V8_TARGET_ARCH_ARM | 1895 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |