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

Side by Side Diff: src/compiler/js-create-lowering.cc

Issue 2820603002: Revert of Merged: Squashed multiple commits. (Closed)
Patch Set: Created 3 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 | src/compiler/js-native-context-specialization.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/compiler/js-create-lowering.h" 5 #include "src/compiler/js-create-lowering.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 PretenureFlag pretenure) { 1090 PretenureFlag pretenure) {
1091 DCHECK_LE(1, capacity); 1091 DCHECK_LE(1, capacity);
1092 DCHECK_LE(capacity, JSArray::kInitialMaxFastElementArray); 1092 DCHECK_LE(capacity, JSArray::kInitialMaxFastElementArray);
1093 1093
1094 Handle<Map> elements_map = IsFastDoubleElementsKind(elements_kind) 1094 Handle<Map> elements_map = IsFastDoubleElementsKind(elements_kind)
1095 ? factory()->fixed_double_array_map() 1095 ? factory()->fixed_double_array_map()
1096 : factory()->fixed_array_map(); 1096 : factory()->fixed_array_map();
1097 ElementAccess access = IsFastDoubleElementsKind(elements_kind) 1097 ElementAccess access = IsFastDoubleElementsKind(elements_kind)
1098 ? AccessBuilder::ForFixedDoubleArrayElement() 1098 ? AccessBuilder::ForFixedDoubleArrayElement()
1099 : AccessBuilder::ForFixedArrayElement(); 1099 : AccessBuilder::ForFixedArrayElement();
1100 Node* value = jsgraph()->TheHoleConstant(); 1100 Node* value;
1101 if (IsFastDoubleElementsKind(elements_kind)) {
1102 // Load the hole NaN pattern from the canonical location.
1103 value = effect = graph()->NewNode(
1104 simplified()->LoadField(AccessBuilder::ForExternalDoubleValue()),
1105 jsgraph()->ExternalConstant(
1106 ExternalReference::address_of_the_hole_nan()),
1107 effect, control);
1108 } else {
1109 value = jsgraph()->TheHoleConstant();
1110 }
1101 1111
1102 // Actually allocate the backing store. 1112 // Actually allocate the backing store.
1103 AllocationBuilder a(jsgraph(), effect, control); 1113 AllocationBuilder a(jsgraph(), effect, control);
1104 a.AllocateArray(capacity, elements_map, pretenure); 1114 a.AllocateArray(capacity, elements_map, pretenure);
1105 for (int i = 0; i < capacity; ++i) { 1115 for (int i = 0; i < capacity; ++i) {
1106 Node* index = jsgraph()->Constant(i); 1116 Node* index = jsgraph()->Constant(i);
1107 a.Store(access, index, value); 1117 a.Store(access, index, value);
1108 } 1118 }
1109 return a.Finish(); 1119 return a.Finish();
1110 } 1120 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 return jsgraph()->HeapConstant(boilerplate_elements); 1248 return jsgraph()->HeapConstant(boilerplate_elements);
1239 } 1249 }
1240 1250
1241 // Compute the elements to store first (might have effects). 1251 // Compute the elements to store first (might have effects).
1242 int const elements_length = boilerplate_elements->length(); 1252 int const elements_length = boilerplate_elements->length();
1243 Handle<Map> elements_map(boilerplate_elements->map(), isolate()); 1253 Handle<Map> elements_map(boilerplate_elements->map(), isolate());
1244 ZoneVector<Node*> elements_values(elements_length, zone()); 1254 ZoneVector<Node*> elements_values(elements_length, zone());
1245 if (elements_map->instance_type() == FIXED_DOUBLE_ARRAY_TYPE) { 1255 if (elements_map->instance_type() == FIXED_DOUBLE_ARRAY_TYPE) {
1246 Handle<FixedDoubleArray> elements = 1256 Handle<FixedDoubleArray> elements =
1247 Handle<FixedDoubleArray>::cast(boilerplate_elements); 1257 Handle<FixedDoubleArray>::cast(boilerplate_elements);
1258 Node* the_hole_value = nullptr;
1248 for (int i = 0; i < elements_length; ++i) { 1259 for (int i = 0; i < elements_length; ++i) {
1249 if (elements->is_the_hole(i)) { 1260 if (elements->is_the_hole(i)) {
1250 elements_values[i] = jsgraph()->TheHoleConstant(); 1261 if (the_hole_value == nullptr) {
1262 // Load the hole NaN pattern from the canonical location.
1263 the_hole_value = effect = graph()->NewNode(
1264 simplified()->LoadField(AccessBuilder::ForExternalDoubleValue()),
1265 jsgraph()->ExternalConstant(
1266 ExternalReference::address_of_the_hole_nan()),
1267 effect, control);
1268 }
1269 elements_values[i] = the_hole_value;
1251 } else { 1270 } else {
1252 elements_values[i] = jsgraph()->Constant(elements->get_scalar(i)); 1271 elements_values[i] = jsgraph()->Constant(elements->get_scalar(i));
1253 } 1272 }
1254 } 1273 }
1255 } else { 1274 } else {
1256 Handle<FixedArray> elements = 1275 Handle<FixedArray> elements =
1257 Handle<FixedArray>::cast(boilerplate_elements); 1276 Handle<FixedArray>::cast(boilerplate_elements);
1258 for (int i = 0; i < elements_length; ++i) { 1277 for (int i = 0; i < elements_length; ++i) {
1259 if (elements->is_the_hole(isolate(), i)) { 1278 if (elements->is_the_hole(isolate(), i)) {
1260 elements_values[i] = jsgraph()->TheHoleConstant(); 1279 elements_values[i] = jsgraph()->TheHoleConstant();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 return jsgraph()->simplified(); 1348 return jsgraph()->simplified();
1330 } 1349 }
1331 1350
1332 MachineOperatorBuilder* JSCreateLowering::machine() const { 1351 MachineOperatorBuilder* JSCreateLowering::machine() const {
1333 return jsgraph()->machine(); 1352 return jsgraph()->machine();
1334 } 1353 }
1335 1354
1336 } // namespace compiler 1355 } // namespace compiler
1337 } // namespace internal 1356 } // namespace internal
1338 } // namespace v8 1357 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698