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

Side by Side Diff: src/hydrogen.cc

Issue 735653003: Revert "Use a stub in crankshaft for grow store arrays." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 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
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 HConstant::cast(function)->handle(isolate())->IsJSFunction()) { 1290 HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
1291 Handle<JSFunction> f = Handle<JSFunction>::cast( 1291 Handle<JSFunction> f = Handle<JSFunction>::cast(
1292 HConstant::cast(function)->handle(isolate())); 1292 HConstant::cast(function)->handle(isolate()));
1293 SharedFunctionInfo* shared = f->shared(); 1293 SharedFunctionInfo* shared = f->shared();
1294 if (shared->strict_mode() == STRICT || shared->native()) return object; 1294 if (shared->strict_mode() == STRICT || shared->native()) return object;
1295 } 1295 }
1296 return Add<HWrapReceiver>(object, function); 1296 return Add<HWrapReceiver>(object, function);
1297 } 1297 }
1298 1298
1299 1299
1300 HValue* HGraphBuilder::BuildCheckAndGrowElementsCapacity(
1301 HValue* object, HValue* elements, ElementsKind kind, HValue* length,
1302 HValue* capacity, HValue* key) {
1303 HValue* max_gap = Add<HConstant>(static_cast<int32_t>(JSObject::kMaxGap));
1304 HValue* max_capacity = AddUncasted<HAdd>(capacity, max_gap);
1305 Add<HBoundsCheck>(key, max_capacity);
1306
1307 HValue* new_capacity = BuildNewElementsCapacity(key);
1308 HValue* new_elements = BuildGrowElementsCapacity(object, elements, kind, kind,
1309 length, new_capacity);
1310 return new_elements;
1311 }
1312
1313
1314 HValue* HGraphBuilder::BuildCheckForCapacityGrow( 1300 HValue* HGraphBuilder::BuildCheckForCapacityGrow(
1315 HValue* object, 1301 HValue* object,
1316 HValue* elements, 1302 HValue* elements,
1317 ElementsKind kind, 1303 ElementsKind kind,
1318 HValue* length, 1304 HValue* length,
1319 HValue* key, 1305 HValue* key,
1320 bool is_js_array, 1306 bool is_js_array,
1321 PropertyAccessType access_type) { 1307 PropertyAccessType access_type) {
1322 IfBuilder length_checker(this); 1308 IfBuilder length_checker(this);
1323 1309
1324 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; 1310 Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
1325 length_checker.If<HCompareNumericAndBranch>(key, length, token); 1311 length_checker.If<HCompareNumericAndBranch>(key, length, token);
1326 1312
1327 length_checker.Then(); 1313 length_checker.Then();
1328 1314
1329 HValue* current_capacity = AddLoadFixedArrayLength(elements); 1315 HValue* current_capacity = AddLoadFixedArrayLength(elements);
1330 1316
1331 IfBuilder capacity_checker(this); 1317 IfBuilder capacity_checker(this);
1332 1318
1333 capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity, 1319 capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity,
1334 Token::GTE); 1320 Token::GTE);
1335 capacity_checker.Then(); 1321 capacity_checker.Then();
1336 1322
1337 // BuildCheckAndGrowElementsCapacity could de-opt without profitable feedback, 1323 HValue* max_gap = Add<HConstant>(static_cast<int32_t>(JSObject::kMaxGap));
1338 // therefore we defer calling it to a stub in optimized functions. It is 1324 HValue* max_capacity = AddUncasted<HAdd>(current_capacity, max_gap);
1339 // okay to call directly in a code stub though, because a bailout to the
1340 // runtime is tolerable in the corner cases.
1341 if (top_info()->IsStub()) {
1342 environment()->Push(BuildCheckAndGrowElementsCapacity(
1343 object, elements, kind, length, current_capacity, key));
1344 } else {
1345 GrowArrayElementsStub stub(isolate(), is_js_array, kind);
1346 GrowArrayElementsDescriptor descriptor(isolate());
1347 HConstant* target = Add<HConstant>(stub.GetCode());
1348 HValue* op_vals[] = {context(), object, key, current_capacity};
1349 HValue* new_elements = Add<HCallWithDescriptor>(
1350 target, 0, descriptor, Vector<HValue*>(op_vals, 4));
1351 // If the object changed to a dictionary, GrowArrayElements will return a
1352 // smi to signal that deopt is required.
1353 Add<HCheckHeapObject>(new_elements);
1354 environment()->Push(new_elements);
1355 }
1356 1325
1326 Add<HBoundsCheck>(key, max_capacity);
1327
1328 HValue* new_capacity = BuildNewElementsCapacity(key);
1329 HValue* new_elements = BuildGrowElementsCapacity(object, elements,
1330 kind, kind, length,
1331 new_capacity);
1332
1333 environment()->Push(new_elements);
1357 capacity_checker.Else(); 1334 capacity_checker.Else();
1358 1335
1359 environment()->Push(elements); 1336 environment()->Push(elements);
1360 capacity_checker.End(); 1337 capacity_checker.End();
1361 1338
1362 if (is_js_array) { 1339 if (is_js_array) {
1363 HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1()); 1340 HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1());
1364 new_length->ClearFlag(HValue::kCanOverflow); 1341 new_length->ClearFlag(HValue::kCanOverflow);
1365 1342
1366 Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind), 1343 Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind),
(...skipping 11389 matching lines...) Expand 10 before | Expand all | Expand 10 after
12756 if (ShouldProduceTraceOutput()) { 12733 if (ShouldProduceTraceOutput()) {
12757 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12734 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12758 } 12735 }
12759 12736
12760 #ifdef DEBUG 12737 #ifdef DEBUG
12761 graph_->Verify(false); // No full verify. 12738 graph_->Verify(false); // No full verify.
12762 #endif 12739 #endif
12763 } 12740 }
12764 12741
12765 } } // namespace v8::internal 12742 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698