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 6112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6123 FastCloneShallowArrayStub::Mode mode = | 6123 FastCloneShallowArrayStub::Mode mode = |
6124 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS | 6124 boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
6125 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 6125 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
6126 : FastCloneShallowArrayStub::CLONE_ELEMENTS; | 6126 : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
6127 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 6127 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
6128 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 6128 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
6129 } | 6129 } |
6130 } | 6130 } |
6131 | 6131 |
6132 | 6132 |
6133 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { | |
6134 ASSERT(ToRegister(instr->context()).is(esi)); | |
6135 Handle<FixedArray> literals = instr->hydrogen()->literals(); | |
6136 Handle<FixedArray> constant_properties = | |
6137 instr->hydrogen()->constant_properties(); | |
6138 | |
6139 int flags = instr->hydrogen()->fast_elements() | |
6140 ? ObjectLiteral::kFastElements | |
6141 : ObjectLiteral::kNoFlags; | |
6142 flags |= instr->hydrogen()->has_function() | |
6143 ? ObjectLiteral::kHasFunction | |
6144 : ObjectLiteral::kNoFlags; | |
6145 | |
6146 // Set up the parameters to the stub/runtime call and pick the right | |
6147 // runtime function or stub to call. | |
6148 int properties_count = instr->hydrogen()->constant_properties_length() / 2; | |
6149 if ((FLAG_track_double_fields && instr->hydrogen()->may_store_doubles()) || | |
6150 instr->hydrogen()->depth() > 1) { | |
6151 __ PushHeapObject(literals); | |
6152 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | |
6153 __ push(Immediate(constant_properties)); | |
6154 __ push(Immediate(Smi::FromInt(flags))); | |
6155 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); | |
6156 } else if (flags != ObjectLiteral::kFastElements || | |
6157 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | |
6158 __ PushHeapObject(literals); | |
6159 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | |
6160 __ push(Immediate(constant_properties)); | |
6161 __ push(Immediate(Smi::FromInt(flags))); | |
6162 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); | |
6163 } else { | |
6164 __ LoadHeapObject(eax, literals); | |
6165 __ mov(ebx, Immediate(Smi::FromInt(instr->hydrogen()->literal_index()))); | |
6166 __ mov(ecx, Immediate(constant_properties)); | |
6167 __ mov(edx, Immediate(Smi::FromInt(flags))); | |
6168 FastCloneShallowObjectStub stub(properties_count); | |
6169 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | |
6170 } | |
6171 } | |
6172 | |
6173 | |
6174 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { | 6133 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { |
6175 ASSERT(ToRegister(instr->value()).is(eax)); | 6134 ASSERT(ToRegister(instr->value()).is(eax)); |
6176 __ push(eax); | 6135 __ push(eax); |
6177 CallRuntime(Runtime::kToFastProperties, 1, instr); | 6136 CallRuntime(Runtime::kToFastProperties, 1, instr); |
6178 } | 6137 } |
6179 | 6138 |
6180 | 6139 |
6181 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { | 6140 void LCodeGen::DoRegExpLiteral(LRegExpLiteral* instr) { |
6182 ASSERT(ToRegister(instr->context()).is(esi)); | 6141 ASSERT(ToRegister(instr->context()).is(esi)); |
6183 Label materialized; | 6142 Label materialized; |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6605 FixedArray::kHeaderSize - kPointerSize)); | 6564 FixedArray::kHeaderSize - kPointerSize)); |
6606 __ bind(&done); | 6565 __ bind(&done); |
6607 } | 6566 } |
6608 | 6567 |
6609 | 6568 |
6610 #undef __ | 6569 #undef __ |
6611 | 6570 |
6612 } } // namespace v8::internal | 6571 } } // namespace v8::internal |
6613 | 6572 |
6614 #endif // V8_TARGET_ARCH_IA32 | 6573 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |