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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 } | 219 } |
220 | 220 |
221 | 221 |
222 static void GenerateFastCloneShallowArrayCommon( | 222 static void GenerateFastCloneShallowArrayCommon( |
223 MacroAssembler* masm, | 223 MacroAssembler* masm, |
224 int length, | 224 int length, |
225 FastCloneShallowArrayStub::Mode mode, | 225 FastCloneShallowArrayStub::Mode mode, |
226 Label* fail) { | 226 Label* fail) { |
227 // Registers on entry: | 227 // Registers on entry: |
228 // | 228 // |
229 // rcx: boilerplate array. | 229 // rcx: boilerplate literal array. |
230 ASSERT(mode != FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS); | 230 ASSERT(mode != FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS); |
231 | 231 |
232 // All sizes here are multiples of kPointerSize. | 232 // All sizes here are multiples of kPointerSize. |
233 int elements_size = 0; | 233 int elements_size = 0; |
234 if (length > 0) { | 234 if (length > 0) { |
235 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS | 235 elements_size = mode == FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
236 ? FixedDoubleArray::SizeFor(length) | 236 ? FixedDoubleArray::SizeFor(length) |
237 : FixedArray::SizeFor(length); | 237 : FixedArray::SizeFor(length); |
238 } | 238 } |
239 int size = JSArray::kSize + elements_size; | 239 int size = JSArray::kSize + elements_size; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 factory->fixed_cow_array_map()); | 308 factory->fixed_cow_array_map()); |
309 __ j(not_equal, &check_fast_elements); | 309 __ j(not_equal, &check_fast_elements); |
310 GenerateFastCloneShallowArrayCommon(masm, 0, | 310 GenerateFastCloneShallowArrayCommon(masm, 0, |
311 COPY_ON_WRITE_ELEMENTS, &slow_case); | 311 COPY_ON_WRITE_ELEMENTS, &slow_case); |
312 __ ret(3 * kPointerSize); | 312 __ ret(3 * kPointerSize); |
313 | 313 |
314 __ bind(&check_fast_elements); | 314 __ bind(&check_fast_elements); |
315 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), | 315 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), |
316 factory->fixed_array_map()); | 316 factory->fixed_array_map()); |
317 __ j(not_equal, &double_elements); | 317 __ j(not_equal, &double_elements); |
318 GenerateFastCloneShallowArrayCommon(masm, 0, | 318 GenerateFastCloneShallowArrayCommon(masm, length_, |
319 CLONE_ELEMENTS, &slow_case); | 319 CLONE_ELEMENTS, &slow_case); |
320 __ ret(3 * kPointerSize); | 320 __ ret(3 * kPointerSize); |
321 | 321 |
322 __ bind(&double_elements); | 322 __ bind(&double_elements); |
323 mode = CLONE_DOUBLE_ELEMENTS; | 323 mode = CLONE_DOUBLE_ELEMENTS; |
324 // Fall through to generate the code to handle double elements. | 324 // Fall through to generate the code to handle double elements. |
325 } | 325 } |
326 | 326 |
327 if (FLAG_debug_code) { | 327 if (FLAG_debug_code) { |
328 const char* message; | 328 const char* message; |
(...skipping 10 matching lines...) Expand all Loading... |
339 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; | 339 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; |
340 } | 340 } |
341 __ push(rcx); | 341 __ push(rcx); |
342 __ movq(rcx, FieldOperand(rcx, JSArray::kElementsOffset)); | 342 __ movq(rcx, FieldOperand(rcx, JSArray::kElementsOffset)); |
343 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 343 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
344 expected_map_index); | 344 expected_map_index); |
345 __ Assert(equal, message); | 345 __ Assert(equal, message); |
346 __ pop(rcx); | 346 __ pop(rcx); |
347 } | 347 } |
348 | 348 |
349 GenerateFastCloneShallowArrayCommon(masm, 0, | 349 GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case); |
350 CLONE_DOUBLE_ELEMENTS, &slow_case); | |
351 __ ret(3 * kPointerSize); | 350 __ ret(3 * kPointerSize); |
352 | 351 |
353 __ bind(&slow_case); | 352 __ bind(&slow_case); |
354 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); | 353 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); |
355 } | 354 } |
356 | 355 |
357 | 356 |
358 // The stub expects its argument on the stack and returns its result in tos_: | 357 // The stub expects its argument on the stack and returns its result in tos_: |
359 // zero for false, and a non-zero value for true. | 358 // zero for false, and a non-zero value for true. |
360 void ToBooleanStub::Generate(MacroAssembler* masm) { | 359 void ToBooleanStub::Generate(MacroAssembler* masm) { |
(...skipping 5701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6062 xmm0, | 6061 xmm0, |
6063 &slow_elements); | 6062 &slow_elements); |
6064 __ ret(0); | 6063 __ ret(0); |
6065 } | 6064 } |
6066 | 6065 |
6067 #undef __ | 6066 #undef __ |
6068 | 6067 |
6069 } } // namespace v8::internal | 6068 } } // namespace v8::internal |
6070 | 6069 |
6071 #endif // V8_TARGET_ARCH_X64 | 6070 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |