| 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 |
| 442 // Jump to the generic array code if the specialized code cannot handle | 442 // Jump to the generic array code if the specialized code cannot handle |
| 443 // the construction. | 443 // the construction. |
| 444 __ bind(&generic_array_code); | 444 __ bind(&generic_array_code); |
| 445 Code* code = Builtins::builtin(Builtins::ArrayCodeGeneric); | 445 Code* code = Builtins::builtin(Builtins::ArrayCodeGeneric); |
| 446 Handle<Code> array_code(code); | 446 Handle<Code> array_code(code); |
| 447 __ Jump(array_code, RelocInfo::CODE_TARGET); | 447 __ Jump(array_code, RelocInfo::CODE_TARGET); |
| 448 } | 448 } |
| 449 | 449 |
| 450 | 450 |
| 451 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { | 451 void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { |
| 452 // ----------- S t a t e ------------- | 452 // ----------- S t a t e ------------- |
| 453 // -- r0 : number of arguments | 453 // -- r0 : number of arguments |
| 454 // -- r1 : constructor function | 454 // -- r1 : constructor function |
| 455 // -- lr : return address | 455 // -- lr : return address |
| 456 // -- sp[...]: constructor arguments | 456 // -- sp[...]: constructor arguments |
| 457 // ----------------------------------- | 457 // ----------------------------------- |
| 458 Label generic_constructor; | 458 Label generic_constructor; |
| 459 | 459 |
| 460 if (FLAG_debug_code) { | 460 if (FLAG_debug_code) { |
| 461 // The array construct code is only set for the builtin Array function which | 461 // The array construct code is only set for the builtin and internal |
| 462 // always have a map. | 462 // Array functions which always have a map. |
| 463 GenerateLoadArrayFunction(masm, r2); | |
| 464 __ cmp(r1, r2); | |
| 465 __ Assert(eq, "Unexpected Array function"); | |
| 466 // Initial map for the builtin Array function should be a map. | 463 // Initial map for the builtin Array function should be a map. |
| 467 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 464 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 468 __ tst(r2, Operand(kSmiTagMask)); | 465 __ tst(r2, Operand(kSmiTagMask)); |
| 469 __ Assert(ne, "Unexpected initial map for Array function"); | 466 __ Assert(ne, "Unexpected initial map for Array function"); |
| 470 __ CompareObjectType(r2, r3, r4, MAP_TYPE); | 467 __ CompareObjectType(r2, r3, r4, MAP_TYPE); |
| 471 __ Assert(eq, "Unexpected initial map for Array function"); | 468 __ Assert(eq, "Unexpected initial map for Array function"); |
| 472 } | 469 } |
| 473 | 470 |
| 474 // Run the native code for the Array function called as a constructor. | 471 // Run the native code for the Array function called as a constructor. |
| 475 ArrayNativeCode(masm, &generic_constructor); | 472 ArrayNativeCode(masm, &generic_constructor); |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 __ bind(&dont_adapt_arguments); | 1616 __ bind(&dont_adapt_arguments); |
| 1620 __ Jump(r3); | 1617 __ Jump(r3); |
| 1621 } | 1618 } |
| 1622 | 1619 |
| 1623 | 1620 |
| 1624 #undef __ | 1621 #undef __ |
| 1625 | 1622 |
| 1626 } } // namespace v8::internal | 1623 } } // namespace v8::internal |
| 1627 | 1624 |
| 1628 #endif // V8_TARGET_ARCH_ARM | 1625 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |