| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "code-stubs.h" | 33 #include "code-stubs.h" |
| 34 #include "regexp-macro-assembler.h" | 34 #include "regexp-macro-assembler.h" |
| 35 #include "stub-cache.h" | 35 #include "stub-cache.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 | 40 |
| 41 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
| 42 Isolate* isolate, |
| 43 CodeStubInterfaceDescriptor* descriptor) { |
| 44 static Register registers[] = { r3, r2, r1, r0 }; |
| 45 descriptor->register_param_count_ = 4; |
| 46 descriptor->register_params_ = registers; |
| 47 descriptor->stack_parameter_count_ = NULL; |
| 48 descriptor->deoptimization_handler_ = |
| 49 Runtime::FunctionForId(Runtime::kCreateObjectLiteralShallow)->entry; |
| 50 } |
| 51 |
| 52 |
| 41 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( | 53 void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
| 42 Isolate* isolate, | 54 Isolate* isolate, |
| 43 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubInterfaceDescriptor* descriptor) { |
| 44 static Register registers[] = { r1, r0 }; | 56 static Register registers[] = { r1, r0 }; |
| 45 descriptor->register_param_count_ = 2; | 57 descriptor->register_param_count_ = 2; |
| 46 descriptor->register_params_ = registers; | 58 descriptor->register_params_ = registers; |
| 47 descriptor->deoptimization_handler_ = | 59 descriptor->deoptimization_handler_ = |
| 48 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); | 60 FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
| 49 } | 61 } |
| 50 | 62 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 505 |
| 494 // Return and remove the on-stack parameters. | 506 // Return and remove the on-stack parameters. |
| 495 __ add(sp, sp, Operand(3 * kPointerSize)); | 507 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 496 __ Ret(); | 508 __ Ret(); |
| 497 | 509 |
| 498 __ bind(&slow_case); | 510 __ bind(&slow_case); |
| 499 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 511 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
| 500 } | 512 } |
| 501 | 513 |
| 502 | 514 |
| 503 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) { | |
| 504 // Stack layout on entry: | |
| 505 // | |
| 506 // [sp]: object literal flags. | |
| 507 // [sp + kPointerSize]: constant properties. | |
| 508 // [sp + (2 * kPointerSize)]: literal index. | |
| 509 // [sp + (3 * kPointerSize)]: literals array. | |
| 510 | |
| 511 // Load boilerplate object into r3 and check if we need to create a | |
| 512 // boilerplate. | |
| 513 Label slow_case; | |
| 514 __ ldr(r3, MemOperand(sp, 3 * kPointerSize)); | |
| 515 __ ldr(r0, MemOperand(sp, 2 * kPointerSize)); | |
| 516 __ add(r3, r3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
| 517 __ ldr(r3, MemOperand(r3, r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | |
| 518 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | |
| 519 __ b(eq, &slow_case); | |
| 520 | |
| 521 // Check that the boilerplate contains only fast properties and we can | |
| 522 // statically determine the instance size. | |
| 523 int size = JSObject::kHeaderSize + length_ * kPointerSize; | |
| 524 __ ldr(r0, FieldMemOperand(r3, HeapObject::kMapOffset)); | |
| 525 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceSizeOffset)); | |
| 526 __ cmp(r0, Operand(size >> kPointerSizeLog2)); | |
| 527 __ b(ne, &slow_case); | |
| 528 | |
| 529 // Allocate the JS object and copy header together with all in-object | |
| 530 // properties from the boilerplate. | |
| 531 __ AllocateInNewSpace(size, r0, r1, r2, &slow_case, TAG_OBJECT); | |
| 532 for (int i = 0; i < size; i += kPointerSize) { | |
| 533 __ ldr(r1, FieldMemOperand(r3, i)); | |
| 534 __ str(r1, FieldMemOperand(r0, i)); | |
| 535 } | |
| 536 | |
| 537 // Return and remove the on-stack parameters. | |
| 538 __ add(sp, sp, Operand(4 * kPointerSize)); | |
| 539 __ Ret(); | |
| 540 | |
| 541 __ bind(&slow_case); | |
| 542 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1); | |
| 543 } | |
| 544 | |
| 545 | |
| 546 // Takes a Smi and converts to an IEEE 64 bit floating point value in two | 515 // Takes a Smi and converts to an IEEE 64 bit floating point value in two |
| 547 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and | 516 // registers. The format is 1 sign bit, 11 exponent bits (biased 1023) and |
| 548 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a | 517 // 52 fraction bits (20 in the first word, 32 in the second). Zeros is a |
| 549 // scratch register. Destroys the source register. No GC occurs during this | 518 // scratch register. Destroys the source register. No GC occurs during this |
| 550 // stub so you don't have to set up the frame. | 519 // stub so you don't have to set up the frame. |
| 551 class ConvertToDoubleStub : public PlatformCodeStub { | 520 class ConvertToDoubleStub : public PlatformCodeStub { |
| 552 public: | 521 public: |
| 553 ConvertToDoubleStub(Register result_reg_1, | 522 ConvertToDoubleStub(Register result_reg_1, |
| 554 Register result_reg_2, | 523 Register result_reg_2, |
| 555 Register source_reg, | 524 Register source_reg, |
| (...skipping 7389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7945 | 7914 |
| 7946 __ Pop(lr, r5, r1); | 7915 __ Pop(lr, r5, r1); |
| 7947 __ Ret(); | 7916 __ Ret(); |
| 7948 } | 7917 } |
| 7949 | 7918 |
| 7950 #undef __ | 7919 #undef __ |
| 7951 | 7920 |
| 7952 } } // namespace v8::internal | 7921 } } // namespace v8::internal |
| 7953 | 7922 |
| 7954 #endif // V8_TARGET_ARCH_ARM | 7923 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |