| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 } | 3852 } |
| 3853 | 3853 |
| 3854 // Check the holder map. | 3854 // Check the holder map. |
| 3855 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), | 3855 __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| 3856 Handle<Map>(current_prototype->map())); | 3856 Handle<Map>(current_prototype->map())); |
| 3857 DeoptimizeIf(not_equal, instr->environment()); | 3857 DeoptimizeIf(not_equal, instr->environment()); |
| 3858 } | 3858 } |
| 3859 | 3859 |
| 3860 | 3860 |
| 3861 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { | 3861 void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| 3862 Handle<FixedArray> constant_elements = instr->hydrogen()->constant_elements(); |
| 3863 ASSERT_EQ(2, constant_elements->length()); |
| 3864 ElementsKind constant_elements_kind = |
| 3865 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 3866 |
| 3862 // Setup the parameters to the stub/runtime call. | 3867 // Setup the parameters to the stub/runtime call. |
| 3863 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 3868 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3864 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); | 3869 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); |
| 3865 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 3870 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
| 3866 __ Push(instr->hydrogen()->constant_elements()); | 3871 __ Push(instr->hydrogen()->constant_elements()); |
| 3867 | 3872 |
| 3868 // Pick the right runtime function or stub to call. | 3873 // Pick the right runtime function or stub to call. |
| 3869 int length = instr->hydrogen()->length(); | 3874 int length = instr->hydrogen()->length(); |
| 3870 if (instr->hydrogen()->IsCopyOnWrite()) { | 3875 if (instr->hydrogen()->IsCopyOnWrite()) { |
| 3871 ASSERT(instr->hydrogen()->depth() == 1); | 3876 ASSERT(instr->hydrogen()->depth() == 1); |
| 3872 FastCloneShallowArrayStub::Mode mode = | 3877 FastCloneShallowArrayStub::Mode mode = |
| 3873 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; | 3878 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| 3874 FastCloneShallowArrayStub stub(mode, length); | 3879 FastCloneShallowArrayStub stub(mode, length); |
| 3875 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3880 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3876 } else if (instr->hydrogen()->depth() > 1) { | 3881 } else if (instr->hydrogen()->depth() > 1) { |
| 3877 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); | 3882 CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
| 3878 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 3883 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 3879 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); | 3884 CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
| 3880 } else { | 3885 } else { |
| 3881 FastCloneShallowArrayStub::Mode mode = | 3886 FastCloneShallowArrayStub::Mode mode = |
| 3882 FastCloneShallowArrayStub::CLONE_ELEMENTS; | 3887 constant_elements_kind == FAST_DOUBLE_ELEMENTS |
| 3888 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 3889 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 3883 FastCloneShallowArrayStub stub(mode, length); | 3890 FastCloneShallowArrayStub stub(mode, length); |
| 3884 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3891 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3885 } | 3892 } |
| 3886 } | 3893 } |
| 3887 | 3894 |
| 3888 | 3895 |
| 3889 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 3896 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 3890 // Setup the parameters to the stub/runtime call. | 3897 // Setup the parameters to the stub/runtime call. |
| 3891 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 3898 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3892 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); | 3899 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4228 RegisterEnvironmentForDeoptimization(environment); | 4235 RegisterEnvironmentForDeoptimization(environment); |
| 4229 ASSERT(osr_pc_offset_ == -1); | 4236 ASSERT(osr_pc_offset_ == -1); |
| 4230 osr_pc_offset_ = masm()->pc_offset(); | 4237 osr_pc_offset_ = masm()->pc_offset(); |
| 4231 } | 4238 } |
| 4232 | 4239 |
| 4233 #undef __ | 4240 #undef __ |
| 4234 | 4241 |
| 4235 } } // namespace v8::internal | 4242 } } // namespace v8::internal |
| 4236 | 4243 |
| 4237 #endif // V8_TARGET_ARCH_X64 | 4244 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |