| OLD | NEW | 
|---|
| 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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1324     PropertyAccessType access_type) { | 1324     PropertyAccessType access_type) { | 
| 1325   IfBuilder length_checker(this); | 1325   IfBuilder length_checker(this); | 
| 1326 | 1326 | 
| 1327   Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; | 1327   Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ; | 
| 1328   length_checker.If<HCompareNumericAndBranch>(key, length, token); | 1328   length_checker.If<HCompareNumericAndBranch>(key, length, token); | 
| 1329 | 1329 | 
| 1330   length_checker.Then(); | 1330   length_checker.Then(); | 
| 1331 | 1331 | 
| 1332   HValue* current_capacity = AddLoadFixedArrayLength(elements); | 1332   HValue* current_capacity = AddLoadFixedArrayLength(elements); | 
| 1333 | 1333 | 
| 1334   IfBuilder capacity_checker(this); |  | 
| 1335 |  | 
| 1336   capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity, |  | 
| 1337                                                 Token::GTE); |  | 
| 1338   capacity_checker.Then(); |  | 
| 1339 |  | 
| 1340   // BuildCheckAndGrowElementsCapacity could de-opt without profitable feedback |  | 
| 1341   // therefore we defer calling it to a stub in optimized functions. It is |  | 
| 1342   // okay to call directly in a code stub though, because a bailout to the |  | 
| 1343   // runtime is tolerable in the corner cases. |  | 
| 1344   if (top_info()->IsStub()) { | 1334   if (top_info()->IsStub()) { | 
|  | 1335     IfBuilder capacity_checker(this); | 
|  | 1336     capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity, | 
|  | 1337                                                   Token::GTE); | 
|  | 1338     capacity_checker.Then(); | 
| 1345     HValue* new_elements = BuildCheckAndGrowElementsCapacity( | 1339     HValue* new_elements = BuildCheckAndGrowElementsCapacity( | 
| 1346         object, elements, kind, length, current_capacity, key); | 1340         object, elements, kind, length, current_capacity, key); | 
| 1347     environment()->Push(new_elements); | 1341     environment()->Push(new_elements); | 
|  | 1342     capacity_checker.Else(); | 
|  | 1343     environment()->Push(elements); | 
|  | 1344     capacity_checker.End(); | 
| 1348   } else { | 1345   } else { | 
| 1349     GrowArrayElementsStub stub(isolate(), is_js_array, kind); | 1346     HValue* result = Add<HMaybeGrowElements>( | 
| 1350     GrowArrayElementsDescriptor descriptor(isolate()); | 1347         object, elements, key, current_capacity, is_js_array, kind); | 
| 1351     HConstant* target = Add<HConstant>(stub.GetCode()); | 1348     environment()->Push(result); | 
| 1352     HValue* op_vals[] = {context(), object, key, current_capacity}; |  | 
| 1353     HValue* new_elements = Add<HCallWithDescriptor>( |  | 
| 1354         target, 0, descriptor, Vector<HValue*>(op_vals, 4)); |  | 
| 1355     // If the object changed to a dictionary, GrowArrayElements will return a |  | 
| 1356     // smi to signal that deopt is required. |  | 
| 1357     Add<HCheckHeapObject>(new_elements); |  | 
| 1358     environment()->Push(new_elements); |  | 
| 1359   } | 1349   } | 
| 1360 | 1350 | 
| 1361   capacity_checker.Else(); |  | 
| 1362 |  | 
| 1363   environment()->Push(elements); |  | 
| 1364   capacity_checker.End(); |  | 
| 1365 |  | 
| 1366   if (is_js_array) { | 1351   if (is_js_array) { | 
| 1367     HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1()); | 1352     HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1()); | 
| 1368     new_length->ClearFlag(HValue::kCanOverflow); | 1353     new_length->ClearFlag(HValue::kCanOverflow); | 
| 1369 | 1354 | 
| 1370     Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind), | 1355     Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind), | 
| 1371                           new_length); | 1356                           new_length); | 
| 1372   } | 1357   } | 
| 1373 | 1358 | 
| 1374   if (access_type == STORE && kind == FAST_SMI_ELEMENTS) { | 1359   if (access_type == STORE && kind == FAST_SMI_ELEMENTS) { | 
| 1375     HValue* checked_elements = environment()->Top(); | 1360     HValue* checked_elements = environment()->Top(); | 
| (...skipping 11771 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 13147   if (ShouldProduceTraceOutput()) { | 13132   if (ShouldProduceTraceOutput()) { | 
| 13148     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13133     isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 
| 13149   } | 13134   } | 
| 13150 | 13135 | 
| 13151 #ifdef DEBUG | 13136 #ifdef DEBUG | 
| 13152   graph_->Verify(false);  // No full verify. | 13137   graph_->Verify(false);  // No full verify. | 
| 13153 #endif | 13138 #endif | 
| 13154 } | 13139 } | 
| 13155 | 13140 | 
| 13156 } }  // namespace v8::internal | 13141 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|