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

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

Issue 8598014: Implement code stub for object literal creation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment by Florian Schneider. Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case); 349 GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case);
350 __ ret(3 * kPointerSize); 350 __ ret(3 * kPointerSize);
351 351
352 __ bind(&slow_case); 352 __ bind(&slow_case);
353 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1); 353 __ TailCallRuntime(Runtime::kCreateArrayLiteralShallow, 3, 1);
354 } 354 }
355 355
356 356
357 void FastCloneShallowObjectStub::Generate(MacroAssembler* masm) {
358 // Stack layout on entry:
359 //
360 // [rsp + kPointerSize]: object literal flags.
361 // [rsp + (2 * kPointerSize)]: constant properties.
362 // [rsp + (3 * kPointerSize)]: literal index.
363 // [rsp + (4 * kPointerSize)]: literals array.
364
365 // Load boilerplate object into ecx and check if we need to create a
366 // boilerplate.
367 Label slow_case;
368 __ movq(rcx, Operand(rsp, 4 * kPointerSize));
369 __ movq(rax, Operand(rsp, 3 * kPointerSize));
370 SmiIndex index = masm->SmiToIndex(rax, rax, kPointerSizeLog2);
371 __ movq(rcx,
372 FieldOperand(rcx, index.reg, index.scale, FixedArray::kHeaderSize));
373 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex);
374 __ j(equal, &slow_case);
375
376 // Check that the boilerplate contains only fast properties and we can
377 // statically determine the instance size.
378 int size = JSObject::kHeaderSize + length_ * kPointerSize;
379 __ movq(rax, FieldOperand(rcx, HeapObject::kMapOffset));
380 __ movzxbq(rax, FieldOperand(rax, Map::kInstanceSizeOffset));
381 __ cmpq(rax, Immediate(size >> kPointerSizeLog2));
382 __ j(not_equal, &slow_case);
383
384 // Allocate the JS object and copy header together with all in-object
385 // properties from the boilerplate.
386 __ AllocateInNewSpace(size, rax, rbx, rdx, &slow_case, TAG_OBJECT);
387 for (int i = 0; i < size; i += kPointerSize) {
388 __ movq(rbx, FieldOperand(rcx, i));
389 __ movq(FieldOperand(rax, i), rbx);
390 }
391
392 // Return and remove the on-stack parameters.
393 __ ret(4 * kPointerSize);
394
395 __ bind(&slow_case);
396 __ TailCallRuntime(Runtime::kCreateObjectLiteralShallow, 4, 1);
397 }
398
399
357 // The stub expects its argument on the stack and returns its result in tos_: 400 // The stub expects its argument on the stack and returns its result in tos_:
358 // zero for false, and a non-zero value for true. 401 // zero for false, and a non-zero value for true.
359 void ToBooleanStub::Generate(MacroAssembler* masm) { 402 void ToBooleanStub::Generate(MacroAssembler* masm) {
360 // This stub overrides SometimesSetsUpAFrame() to return false. That means 403 // This stub overrides SometimesSetsUpAFrame() to return false. That means
361 // we cannot call anything that could cause a GC from this stub. 404 // we cannot call anything that could cause a GC from this stub.
362 Label patch; 405 Label patch;
363 const Register argument = rax; 406 const Register argument = rax;
364 const Register map = rdx; 407 const Register map = rdx;
365 408
366 if (!types_.IsEmpty()) { 409 if (!types_.IsEmpty()) {
(...skipping 5694 matching lines...) Expand 10 before | Expand all | Expand 10 after
6061 xmm0, 6104 xmm0,
6062 &slow_elements); 6105 &slow_elements);
6063 __ ret(0); 6106 __ ret(0);
6064 } 6107 }
6065 6108
6066 #undef __ 6109 #undef __
6067 6110
6068 } } // namespace v8::internal 6111 } } // namespace v8::internal
6069 6112
6070 #endif // V8_TARGET_ARCH_X64 6113 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698