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

Side by Side Diff: src/crankshaft/hydrogen-instructions.cc

Issue 1912553002: Fix 'typeof null' canonicalization in crankshaft (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-opt-typeof-null.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/crankshaft/hydrogen-instructions.h" 5 #include "src/crankshaft/hydrogen-instructions.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/safe_math.h" 8 #include "src/base/safe_math.h"
9 #include "src/crankshaft/hydrogen-infer-representation.h" 9 #include "src/crankshaft/hydrogen-infer-representation.h"
10 #include "src/double.h" 10 #include "src/double.h"
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 os << NameOf(value()) << " == " << type_literal()->ToCString().get(); 1196 os << NameOf(value()) << " == " << type_literal()->ToCString().get();
1197 return HControlInstruction::PrintDataTo(os); 1197 return HControlInstruction::PrintDataTo(os);
1198 } 1198 }
1199 1199
1200 1200
1201 namespace { 1201 namespace {
1202 1202
1203 String* TypeOfString(HConstant* constant, Isolate* isolate) { 1203 String* TypeOfString(HConstant* constant, Isolate* isolate) {
1204 Heap* heap = isolate->heap(); 1204 Heap* heap = isolate->heap();
1205 if (constant->HasNumberValue()) return heap->number_string(); 1205 if (constant->HasNumberValue()) return heap->number_string();
1206 if (constant->GetInstanceType() == ODDBALL_TYPE &&
1207 constant->GetUnique().IsKnownGlobal(heap->null_value())) {
1208 return heap->object_string();
1209 }
1206 if (constant->IsUndetectable()) return heap->undefined_string(); 1210 if (constant->IsUndetectable()) return heap->undefined_string();
1207 if (constant->HasStringValue()) return heap->string_string(); 1211 if (constant->HasStringValue()) return heap->string_string();
1208 switch (constant->GetInstanceType()) { 1212 switch (constant->GetInstanceType()) {
1209 case ODDBALL_TYPE: { 1213 case ODDBALL_TYPE: {
1210 Unique<Object> unique = constant->GetUnique(); 1214 Unique<Object> unique = constant->GetUnique();
1211 if (unique.IsKnownGlobal(heap->true_value()) || 1215 if (unique.IsKnownGlobal(heap->true_value()) ||
1212 unique.IsKnownGlobal(heap->false_value())) { 1216 unique.IsKnownGlobal(heap->false_value())) {
1213 return heap->boolean_string(); 1217 return heap->boolean_string();
1214 } 1218 }
1215 if (unique.IsKnownGlobal(heap->null_value())) { 1219 if (unique.IsKnownGlobal(heap->null_value())) {
Jakob Kummerow 2016/04/21 09:30:56 This is dead code now, replace with DCHECK and com
1216 return heap->object_string(); 1220 return heap->object_string();
1217 } 1221 }
1218 DCHECK(unique.IsKnownGlobal(heap->undefined_value())); 1222 DCHECK(unique.IsKnownGlobal(heap->undefined_value()));
1219 return heap->undefined_string(); 1223 return heap->undefined_string();
1220 } 1224 }
1221 case SYMBOL_TYPE: 1225 case SYMBOL_TYPE:
1222 return heap->symbol_string(); 1226 return heap->symbol_string();
1223 case SIMD128_VALUE_TYPE: { 1227 case SIMD128_VALUE_TYPE: {
1224 Unique<Map> map = constant->ObjectMap(); 1228 Unique<Map> map = constant->ObjectMap();
1225 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ 1229 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 case HObjectAccess::kExternalMemory: 4133 case HObjectAccess::kExternalMemory:
4130 os << "[external-memory]"; 4134 os << "[external-memory]";
4131 break; 4135 break;
4132 } 4136 }
4133 4137
4134 return os << "@" << access.offset(); 4138 return os << "@" << access.offset();
4135 } 4139 }
4136 4140
4137 } // namespace internal 4141 } // namespace internal
4138 } // namespace v8 4142 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-opt-typeof-null.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698