Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 8363025: MIPS: port Support array literals with FAST_DOUBLE_ELEMENTS ElementsKind. (Closed)
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 257
258 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { 258 void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) {
259 // Stack layout on entry: 259 // Stack layout on entry:
260 // [sp]: constant elements. 260 // [sp]: constant elements.
261 // [sp + kPointerSize]: literal index. 261 // [sp + kPointerSize]: literal index.
262 // [sp + (2 * kPointerSize)]: literals array. 262 // [sp + (2 * kPointerSize)]: literals array.
263 263
264 // All sizes here are multiples of kPointerSize. 264 // All sizes here are multiples of kPointerSize.
265 int elements_size = (length_ > 0) ? FixedArray::SizeFor(length_) : 0; 265 int elements_size = 0;
266 if (length_ > 0) {
267 elements_size = mode_ == CLONE_DOUBLE_ELEMENTS
268 ? FixedDoubleArray::SizeFor(length_)
269 : FixedArray::SizeFor(length_);
270 }
266 int size = JSArray::kSize + elements_size; 271 int size = JSArray::kSize + elements_size;
267 272
268 // Load boilerplate object into r3 and check if we need to create a 273 // Load boilerplate object into r3 and check if we need to create a
269 // boilerplate. 274 // boilerplate.
270 Label slow_case; 275 Label slow_case;
271 __ lw(a3, MemOperand(sp, 2 * kPointerSize)); 276 __ lw(a3, MemOperand(sp, 2 * kPointerSize));
272 __ lw(a0, MemOperand(sp, 1 * kPointerSize)); 277 __ lw(a0, MemOperand(sp, 1 * kPointerSize));
273 __ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 278 __ Addu(a3, a3, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
274 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize); 279 __ sll(t0, a0, kPointerSizeLog2 - kSmiTagSize);
275 __ Addu(t0, a3, t0); 280 __ Addu(t0, a3, t0);
276 __ lw(a3, MemOperand(t0)); 281 __ lw(a3, MemOperand(t0));
277 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); 282 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex);
278 __ Branch(&slow_case, eq, a3, Operand(t1)); 283 __ Branch(&slow_case, eq, a3, Operand(t1));
279 284
280 if (FLAG_debug_code) { 285 if (FLAG_debug_code) {
281 const char* message; 286 const char* message;
282 Heap::RootListIndex expected_map_index; 287 Heap::RootListIndex expected_map_index;
283 if (mode_ == CLONE_ELEMENTS) { 288 if (mode_ == CLONE_ELEMENTS) {
284 message = "Expected (writable) fixed array"; 289 message = "Expected (writable) fixed array";
285 expected_map_index = Heap::kFixedArrayMapRootIndex; 290 expected_map_index = Heap::kFixedArrayMapRootIndex;
291 } else if (mode_ == CLONE_DOUBLE_ELEMENTS) {
292 message = "Expected (writable) fixed double array";
293 expected_map_index = Heap::kFixedDoubleArrayMapRootIndex;
286 } else { 294 } else {
287 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS); 295 ASSERT(mode_ == COPY_ON_WRITE_ELEMENTS);
288 message = "Expected copy-on-write fixed array"; 296 message = "Expected copy-on-write fixed array";
289 expected_map_index = Heap::kFixedCOWArrayMapRootIndex; 297 expected_map_index = Heap::kFixedCOWArrayMapRootIndex;
290 } 298 }
291 __ push(a3); 299 __ push(a3);
292 __ lw(a3, FieldMemOperand(a3, JSArray::kElementsOffset)); 300 __ lw(a3, FieldMemOperand(a3, JSArray::kElementsOffset));
293 __ lw(a3, FieldMemOperand(a3, HeapObject::kMapOffset)); 301 __ lw(a3, FieldMemOperand(a3, HeapObject::kMapOffset));
294 __ LoadRoot(at, expected_map_index); 302 __ LoadRoot(at, expected_map_index);
295 __ Assert(eq, message, a3, Operand(at)); 303 __ Assert(eq, message, a3, Operand(at));
(...skipping 19 matching lines...) Expand all
315 } 323 }
316 324
317 if (length_ > 0) { 325 if (length_ > 0) {
318 // Get hold of the elements array of the boilerplate and setup the 326 // Get hold of the elements array of the boilerplate and setup the
319 // elements pointer in the resulting object. 327 // elements pointer in the resulting object.
320 __ lw(a3, FieldMemOperand(a3, JSArray::kElementsOffset)); 328 __ lw(a3, FieldMemOperand(a3, JSArray::kElementsOffset));
321 __ Addu(a2, v0, Operand(JSArray::kSize)); 329 __ Addu(a2, v0, Operand(JSArray::kSize));
322 __ sw(a2, FieldMemOperand(v0, JSArray::kElementsOffset)); 330 __ sw(a2, FieldMemOperand(v0, JSArray::kElementsOffset));
323 331
324 // Copy the elements array. 332 // Copy the elements array.
333 ASSERT((elements_size % kPointerSize) == 0);
325 __ CopyFields(a2, a3, a1.bit(), elements_size / kPointerSize); 334 __ CopyFields(a2, a3, a1.bit(), elements_size / kPointerSize);
326 } 335 }
327 336
328 // Return and remove the on-stack parameters. 337 // Return and remove the on-stack parameters.
329 __ Addu(sp, sp, Operand(3 * kPointerSize)); 338 __ Addu(sp, sp, Operand(3 * kPointerSize));
330 __ Ret(); 339 __ Ret();
331 340
332 __ bind(&slow_case); 341 __ bind(&slow_case);
333 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 342 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
334 } 343 }
(...skipping 7109 matching lines...) Expand 10 before | Expand all | Expand 10 after
7444 7453
7445 // Fall through when we need to inform the incremental marker. 7454 // Fall through when we need to inform the incremental marker.
7446 } 7455 }
7447 7456
7448 7457
7449 #undef __ 7458 #undef __
7450 7459
7451 } } // namespace v8::internal 7460 } } // namespace v8::internal
7452 7461
7453 #endif // V8_TARGET_ARCH_MIPS 7462 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698