| 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 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3920 constant_elements_kind == FAST_DOUBLE_ELEMENTS | 3920 constant_elements_kind == FAST_DOUBLE_ELEMENTS |
| 3921 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 3921 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| 3922 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 3922 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 3923 FastCloneShallowArrayStub stub(mode, length); | 3923 FastCloneShallowArrayStub stub(mode, length); |
| 3924 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 3924 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3925 } | 3925 } |
| 3926 } | 3926 } |
| 3927 | 3927 |
| 3928 | 3928 |
| 3929 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | 3929 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
| 3930 Handle<FixedArray> constant_properties = |
| 3931 instr->hydrogen()->constant_properties(); |
| 3932 |
| 3930 // Setup the parameters to the stub/runtime call. | 3933 // Setup the parameters to the stub/runtime call. |
| 3931 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 3934 __ movq(rax, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3932 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); | 3935 __ push(FieldOperand(rax, JSFunction::kLiteralsOffset)); |
| 3933 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); | 3936 __ Push(Smi::FromInt(instr->hydrogen()->literal_index())); |
| 3934 __ Push(instr->hydrogen()->constant_properties()); | 3937 __ Push(constant_properties); |
| 3935 __ Push(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0)); | 3938 int flags = instr->hydrogen()->fast_elements() |
| 3939 ? ObjectLiteral::kFastElements |
| 3940 : ObjectLiteral::kNoFlags; |
| 3941 flags |= instr->hydrogen()->has_function() |
| 3942 ? ObjectLiteral::kHasFunction |
| 3943 : ObjectLiteral::kNoFlags; |
| 3944 __ Push(Smi::FromInt(flags)); |
| 3936 | 3945 |
| 3937 // Pick the right runtime function to call. | 3946 // Pick the right runtime function to call. |
| 3947 int properties_count = constant_properties->length() / 2; |
| 3938 if (instr->hydrogen()->depth() > 1) { | 3948 if (instr->hydrogen()->depth() > 1) { |
| 3939 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | 3949 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); |
| 3950 } else if (flags != ObjectLiteral::kFastElements || |
| 3951 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 3952 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); |
| 3940 } else { | 3953 } else { |
| 3941 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | 3954 FastCloneShallowObjectStub stub(properties_count); |
| 3955 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 3942 } | 3956 } |
| 3943 } | 3957 } |
| 3944 | 3958 |
| 3945 | 3959 |
| 3946 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 3960 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
| 3947 ASSERT(ToRegister(instr->InputAt(0)).is(rax)); | 3961 ASSERT(ToRegister(instr->InputAt(0)).is(rax)); |
| 3948 __ push(rax); | 3962 __ push(rax); |
| 3949 CallRuntime(Runtime::kToFastProperties, 1, instr); | 3963 CallRuntime(Runtime::kToFastProperties, 1, instr); |
| 3950 } | 3964 } |
| 3951 | 3965 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4287 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4301 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4288 ASSERT(osr_pc_offset_ == -1); | 4302 ASSERT(osr_pc_offset_ == -1); |
| 4289 osr_pc_offset_ = masm()->pc_offset(); | 4303 osr_pc_offset_ = masm()->pc_offset(); |
| 4290 } | 4304 } |
| 4291 | 4305 |
| 4292 #undef __ | 4306 #undef __ |
| 4293 | 4307 |
| 4294 } } // namespace v8::internal | 4308 } } // namespace v8::internal |
| 4295 | 4309 |
| 4296 #endif // V8_TARGET_ARCH_X64 | 4310 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |