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

Unified Diff: src/compiler/code-generator.cc

Issue 2188533002: [turbofan] Generate loop exits in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix 64-bit Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/bytecode-loop-analysis.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 97cc76289ffaf3c31f1e6e23c684fb6f1bc28e3d..c6e6ed4797f49e6906543ec9434a69ba8d5d44ef 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -861,14 +861,33 @@ void CodeGenerator::AddTranslationForOperand(Translation* translation,
Handle<Object> constant_object;
switch (constant.type()) {
case Constant::kInt32:
- DCHECK(type == MachineType::Int32() || type == MachineType::Uint32() ||
- type.representation() == MachineRepresentation::kBit ||
- type.representation() == MachineRepresentation::kNone);
- DCHECK(type.representation() != MachineRepresentation::kNone ||
- constant.ToInt32() == FrameStateDescriptor::kImpossibleValue);
-
+ if (type.representation() == MachineRepresentation::kTagged) {
+ // When pointers are 4 bytes, we can use int32 constants to represent
+ // Smis.
+ DCHECK_EQ(4, kPointerSize);
+ constant_object =
+ handle(reinterpret_cast<Smi*>(constant.ToInt32()), isolate());
+ DCHECK(constant_object->IsSmi());
+ } else {
+ DCHECK(type == MachineType::Int32() ||
+ type == MachineType::Uint32() ||
+ type.representation() == MachineRepresentation::kBit ||
+ type.representation() == MachineRepresentation::kNone);
+ DCHECK(type.representation() != MachineRepresentation::kNone ||
+ constant.ToInt32() == FrameStateDescriptor::kImpossibleValue);
+
+ constant_object =
+ isolate()->factory()->NewNumberFromInt(constant.ToInt32());
+ }
+ break;
+ case Constant::kInt64:
+ // When pointers are 8 bytes, we can use int64 constants to represent
+ // Smis.
+ DCHECK_EQ(type.representation(), MachineRepresentation::kTagged);
+ DCHECK_EQ(8, kPointerSize);
constant_object =
- isolate()->factory()->NewNumberFromInt(constant.ToInt32());
+ handle(reinterpret_cast<Smi*>(constant.ToInt64()), isolate());
+ DCHECK(constant_object->IsSmi());
break;
case Constant::kFloat32:
DCHECK(type.representation() == MachineRepresentation::kFloat32 ||
« no previous file with comments | « src/compiler/bytecode-loop-analysis.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698