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

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 10254006: Fix LFastLiteral to check boilerplate elements kind. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4315 } 4315 }
4316 } else { 4316 } else {
4317 UNREACHABLE(); 4317 UNREACHABLE();
4318 } 4318 }
4319 } 4319 }
4320 } 4320 }
4321 4321
4322 4322
4323 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { 4323 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4324 int size = instr->hydrogen()->total_size(); 4324 int size = instr->hydrogen()->total_size();
4325 ElementsKind boilerplate_elements_kind =
4326 instr->hydrogen()->boilerplate()->GetElementsKind();
4327
4328 // Deopt if the literal boilerplate ElementsKind is of a type different than
4329 // the expected one. The check isn't necessary if the boilerplate has already
4330 // been converted to FAST_ELEMENTS.
4331 if (boilerplate_elements_kind != FAST_ELEMENTS) {
4332 __ LoadHeapObject(rbx, instr->hydrogen()->boilerplate());
4333 __ movq(rcx, FieldOperand(rbx, HeapObject::kMapOffset));
4334 // Load the map's "bit field 2".
4335 __ movb(rcx, FieldOperand(rcx, Map::kBitField2Offset));
4336 // Retrieve elements_kind from bit field 2.
4337 __ and_(rcx, Immediate(Map::kElementsKindMask));
4338 __ cmpb(rcx, Immediate(boilerplate_elements_kind <<
4339 Map::kElementsKindShift));
4340 DeoptimizeIf(not_equal, instr->environment());
4341 }
4325 4342
4326 // Allocate all objects that are part of the literal in one big 4343 // Allocate all objects that are part of the literal in one big
4327 // allocation. This avoids multiple limit checks. 4344 // allocation. This avoids multiple limit checks.
4328 Label allocated, runtime_allocate; 4345 Label allocated, runtime_allocate;
4329 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT); 4346 __ AllocateInNewSpace(size, rax, rcx, rdx, &runtime_allocate, TAG_OBJECT);
4330 __ jmp(&allocated); 4347 __ jmp(&allocated);
4331 4348
4332 __ bind(&runtime_allocate); 4349 __ bind(&runtime_allocate);
4333 __ Push(Smi::FromInt(size)); 4350 __ Push(Smi::FromInt(size));
4334 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); 4351 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
4800 FixedArray::kHeaderSize - kPointerSize)); 4817 FixedArray::kHeaderSize - kPointerSize));
4801 __ bind(&done); 4818 __ bind(&done);
4802 } 4819 }
4803 4820
4804 4821
4805 #undef __ 4822 #undef __
4806 4823
4807 } } // namespace v8::internal 4824 } } // namespace v8::internal
4808 4825
4809 #endif // V8_TARGET_ARCH_X64 4826 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | test/mjsunit/regress/regress-fast-literal-transition.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698