| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // -- r0 : number of arguments | 421 // -- r0 : number of arguments |
| 422 // -- lr : return address | 422 // -- lr : return address |
| 423 // -- sp[...]: constructor arguments | 423 // -- sp[...]: constructor arguments |
| 424 // ----------------------------------- | 424 // ----------------------------------- |
| 425 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 425 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
| 426 | 426 |
| 427 // Get the Array function. | 427 // Get the Array function. |
| 428 GenerateLoadArrayFunction(masm, r1); | 428 GenerateLoadArrayFunction(masm, r1); |
| 429 | 429 |
| 430 if (FLAG_debug_code) { | 430 if (FLAG_debug_code) { |
| 431 // Initial map for the builtin Array function shoud be a map. | 431 // Initial map for the builtin Array functions should be maps. |
| 432 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 432 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 433 __ tst(r2, Operand(kSmiTagMask)); | 433 __ tst(r2, Operand(kSmiTagMask)); |
| 434 __ Assert(ne, "Unexpected initial map for Array function"); | 434 __ Assert(ne, "Unexpected initial map for Array function"); |
| 435 __ CompareObjectType(r2, r3, r4, MAP_TYPE); | 435 __ CompareObjectType(r2, r3, r4, MAP_TYPE); |
| 436 __ Assert(eq, "Unexpected initial map for Array function"); | 436 __ Assert(eq, "Unexpected initial map for Array function"); |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Run the native code for the Array function called as a normal function. | 439 // Run the native code for the Array function called as a normal function. |
| 440 ArrayNativeCode(masm, &generic_array_code); | 440 ArrayNativeCode(masm, &generic_array_code); |
| 441 | 441 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 452 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 452 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { |
| 453 // ----------- S t a t e ------------- | 453 // ----------- S t a t e ------------- |
| 454 // -- r0 : number of arguments | 454 // -- r0 : number of arguments |
| 455 // -- r1 : constructor function | 455 // -- r1 : constructor function |
| 456 // -- lr : return address | 456 // -- lr : return address |
| 457 // -- sp[...]: constructor arguments | 457 // -- sp[...]: constructor arguments |
| 458 // ----------------------------------- | 458 // ----------------------------------- |
| 459 Label generic_constructor; | 459 Label generic_constructor; |
| 460 | 460 |
| 461 if (FLAG_debug_code) { | 461 if (FLAG_debug_code) { |
| 462 // The array construct code is only set for the builtin Array function which | 462 // The array construct code is only set for the builtin and internal |
| 463 // always have a map. | 463 // Array functions which always have a map. |
| 464 GenerateLoadArrayFunction(masm, r2); | |
| 465 __ cmp(r1, r2); | |
| 466 __ Assert(eq, "Unexpected Array function"); | |
| 467 // Initial map for the builtin Array function should be a map. | 464 // Initial map for the builtin Array function should be a map. |
| 468 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 465 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 469 __ tst(r2, Operand(kSmiTagMask)); | 466 __ tst(r2, Operand(kSmiTagMask)); |
| 470 __ Assert(ne, "Unexpected initial map for Array function"); | 467 __ Assert(ne, "Unexpected initial map for Array function"); |
| 471 __ CompareObjectType(r2, r3, r4, MAP_TYPE); | 468 __ CompareObjectType(r2, r3, r4, MAP_TYPE); |
| 472 __ Assert(eq, "Unexpected initial map for Array function"); | 469 __ Assert(eq, "Unexpected initial map for Array function"); |
| 473 } | 470 } |
| 474 | 471 |
| 475 // Run the native code for the Array function called as a constructor. | 472 // Run the native code for the Array function called as a constructor. |
| 476 ArrayNativeCode(masm, &generic_constructor); | 473 ArrayNativeCode(masm, &generic_constructor); |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 __ bind(&dont_adapt_arguments); | 1619 __ bind(&dont_adapt_arguments); |
| 1623 __ Jump(r3); | 1620 __ Jump(r3); |
| 1624 } | 1621 } |
| 1625 | 1622 |
| 1626 | 1623 |
| 1627 #undef __ | 1624 #undef __ |
| 1628 | 1625 |
| 1629 } } // namespace v8::internal | 1626 } } // namespace v8::internal |
| 1630 | 1627 |
| 1631 #endif // V8_TARGET_ARCH_ARM | 1628 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |