| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 314 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| 315 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } | 315 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } |
| 316 HBasicBlock* entry_block() const { return entry_block_; } | 316 HBasicBlock* entry_block() const { return entry_block_; } |
| 317 HEnvironment* start_environment() const { return start_environment_; } | 317 HEnvironment* start_environment() const { return start_environment_; } |
| 318 | 318 |
| 319 void FinalizeUniqueValueIds(); | 319 void FinalizeUniqueValueIds(); |
| 320 bool ProcessArgumentsObject(); | 320 bool ProcessArgumentsObject(); |
| 321 void OrderBlocks(); | 321 void OrderBlocks(); |
| 322 void AssignDominators(); | 322 void AssignDominators(); |
| 323 void SetupInformativeDefinitions(); | |
| 324 void RestoreActualValues(); | 323 void RestoreActualValues(); |
| 325 | 324 |
| 326 // Returns false if there are phi-uses of the arguments-object | 325 // Returns false if there are phi-uses of the arguments-object |
| 327 // which are not supported by the optimizing compiler. | 326 // which are not supported by the optimizing compiler. |
| 328 bool CheckArgumentsPhiUses(); | 327 bool CheckArgumentsPhiUses(); |
| 329 | 328 |
| 330 // Returns false if there are phi-uses of an uninitialized const | 329 // Returns false if there are phi-uses of an uninitialized const |
| 331 // which are not supported by the optimizing compiler. | 330 // which are not supported by the optimizing compiler. |
| 332 bool CheckConstPhiUses(); | 331 bool CheckConstPhiUses(); |
| 333 | 332 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 private: | 460 private: |
| 462 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, | 461 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, |
| 463 int32_t integer_value); | 462 int32_t integer_value); |
| 464 | 463 |
| 465 template<class Phase> | 464 template<class Phase> |
| 466 void Run() { | 465 void Run() { |
| 467 Phase phase(this); | 466 Phase phase(this); |
| 468 phase.Run(); | 467 phase.Run(); |
| 469 } | 468 } |
| 470 | 469 |
| 471 void CheckForBackEdge(HBasicBlock* block, HBasicBlock* successor); | |
| 472 void SetupInformativeDefinitionsInBlock(HBasicBlock* block); | |
| 473 void SetupInformativeDefinitionsRecursively(HBasicBlock* block); | |
| 474 void EliminateRedundantBoundsChecksUsingInductionVariables(); | 470 void EliminateRedundantBoundsChecksUsingInductionVariables(); |
| 475 | 471 |
| 476 Isolate* isolate_; | 472 Isolate* isolate_; |
| 477 int next_block_id_; | 473 int next_block_id_; |
| 478 HBasicBlock* entry_block_; | 474 HBasicBlock* entry_block_; |
| 479 HEnvironment* start_environment_; | 475 HEnvironment* start_environment_; |
| 480 ZoneList<HBasicBlock*> blocks_; | 476 ZoneList<HBasicBlock*> blocks_; |
| 481 ZoneList<HValue*> values_; | 477 ZoneList<HValue*> values_; |
| 482 ZoneList<HPhi*>* phi_list_; | 478 ZoneList<HPhi*>* phi_list_; |
| 483 ZoneList<HInstruction*>* uint32_instructions_; | 479 ZoneList<HInstruction*>* uint32_instructions_; |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 HInstruction* AddUncasted(P1 p1, P2 p2) { | 1051 HInstruction* AddUncasted(P1 p1, P2 p2) { |
| 1056 HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2)); | 1052 HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2)); |
| 1057 // Specializations must have their parameters properly casted | 1053 // Specializations must have their parameters properly casted |
| 1058 // to avoid landing here. | 1054 // to avoid landing here. |
| 1059 ASSERT(!result->IsSimulate()); | 1055 ASSERT(!result->IsSimulate()); |
| 1060 return result; | 1056 return result; |
| 1061 } | 1057 } |
| 1062 | 1058 |
| 1063 template<class I, class P1, class P2> | 1059 template<class I, class P1, class P2> |
| 1064 I* Add(P1 p1, P2 p2) { | 1060 I* Add(P1 p1, P2 p2) { |
| 1065 return static_cast<I*>(AddUncasted<I>(p1, p2)); | 1061 return I::cast(AddUncasted<I>(p1, p2)); |
| 1066 } | 1062 } |
| 1067 | 1063 |
| 1068 template<class I, class P1, class P2, class P3> | 1064 template<class I, class P1, class P2, class P3> |
| 1069 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3) { | 1065 HInstruction* NewUncasted(P1 p1, P2 p2, P3 p3) { |
| 1070 return I::New(zone(), context(), p1, p2, p3); | 1066 return I::New(zone(), context(), p1, p2, p3); |
| 1071 } | 1067 } |
| 1072 | 1068 |
| 1073 template<class I, class P1, class P2, class P3> | 1069 template<class I, class P1, class P2, class P3> |
| 1074 I* New(P1 p1, P2 p2, P3 p3) { | 1070 I* New(P1 p1, P2 p2, P3 p3) { |
| 1075 return I::cast(NewUncasted<I>(p1, p2, p3)); | 1071 return I::cast(NewUncasted<I>(p1, p2, p3)); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 ElementsKind kind, | 1218 ElementsKind kind, |
| 1223 HValue* length); | 1219 HValue* length); |
| 1224 | 1220 |
| 1225 void BuildTransitionElementsKind(HValue* object, | 1221 void BuildTransitionElementsKind(HValue* object, |
| 1226 HValue* map, | 1222 HValue* map, |
| 1227 ElementsKind from_kind, | 1223 ElementsKind from_kind, |
| 1228 ElementsKind to_kind, | 1224 ElementsKind to_kind, |
| 1229 bool is_jsarray); | 1225 bool is_jsarray); |
| 1230 | 1226 |
| 1231 HInstruction* BuildUncheckedMonomorphicElementAccess( | 1227 HInstruction* BuildUncheckedMonomorphicElementAccess( |
| 1232 HValue* object, | 1228 HValue* checked_object, |
| 1233 HValue* key, | 1229 HValue* key, |
| 1234 HValue* val, | 1230 HValue* val, |
| 1235 HCheckMaps* mapcheck, | |
| 1236 bool is_js_array, | 1231 bool is_js_array, |
| 1237 ElementsKind elements_kind, | 1232 ElementsKind elements_kind, |
| 1238 bool is_store, | 1233 bool is_store, |
| 1239 LoadKeyedHoleMode load_mode, | 1234 LoadKeyedHoleMode load_mode, |
| 1240 KeyedAccessStoreMode store_mode); | 1235 KeyedAccessStoreMode store_mode); |
| 1241 | 1236 |
| 1242 HInstruction* AddExternalArrayElementAccess( | 1237 HInstruction* AddExternalArrayElementAccess( |
| 1243 HValue* external_elements, | 1238 HValue* external_elements, |
| 1244 HValue* checked_key, | 1239 HValue* checked_key, |
| 1245 HValue* val, | 1240 HValue* val, |
| 1246 HValue* dependency, | 1241 HValue* dependency, |
| 1247 ElementsKind elements_kind, | 1242 ElementsKind elements_kind, |
| 1248 bool is_store); | 1243 bool is_store); |
| 1249 | 1244 |
| 1250 HInstruction* AddFastElementAccess( | 1245 HInstruction* AddFastElementAccess( |
| 1251 HValue* elements, | 1246 HValue* elements, |
| 1252 HValue* checked_key, | 1247 HValue* checked_key, |
| 1253 HValue* val, | 1248 HValue* val, |
| 1254 HValue* dependency, | 1249 HValue* dependency, |
| 1255 ElementsKind elements_kind, | 1250 ElementsKind elements_kind, |
| 1256 bool is_store, | 1251 bool is_store, |
| 1257 LoadKeyedHoleMode load_mode, | 1252 LoadKeyedHoleMode load_mode, |
| 1258 KeyedAccessStoreMode store_mode); | 1253 KeyedAccessStoreMode store_mode); |
| 1259 | 1254 |
| 1260 HLoadNamedField* BuildLoadNamedField( | 1255 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); |
| 1261 HValue* object, | 1256 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value); |
| 1262 HObjectAccess access, | 1257 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map>); |
| 1263 HValue* typecheck); | 1258 HLoadNamedField* AddLoadElements(HValue* object); |
| 1264 HInstruction* BuildLoadStringLength(HValue* object, HValue* typecheck); | |
| 1265 HStoreNamedField* AddStoreMapConstant(HValue *object, Handle<Map>); | |
| 1266 HLoadNamedField* AddLoadElements(HValue *object, HValue *typecheck); | |
| 1267 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1259 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
| 1268 | 1260 |
| 1269 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1261 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
| 1270 | 1262 |
| 1271 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1263 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
| 1272 | 1264 |
| 1273 void PushAndAdd(HInstruction* instr); | 1265 void PushAndAdd(HInstruction* instr); |
| 1274 | 1266 |
| 1275 void FinishExitWithHardDeoptimization(const char* reason, | 1267 void FinishExitWithHardDeoptimization(const char* reason, |
| 1276 HBasicBlock* continuation); | 1268 HBasicBlock* continuation); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 enum Direction { | 1405 enum Direction { |
| 1414 kPreIncrement, | 1406 kPreIncrement, |
| 1415 kPostIncrement, | 1407 kPostIncrement, |
| 1416 kPreDecrement, | 1408 kPreDecrement, |
| 1417 kPostDecrement | 1409 kPostDecrement |
| 1418 }; | 1410 }; |
| 1419 | 1411 |
| 1420 LoopBuilder(HGraphBuilder* builder, | 1412 LoopBuilder(HGraphBuilder* builder, |
| 1421 HValue* context, | 1413 HValue* context, |
| 1422 Direction direction); | 1414 Direction direction); |
| 1415 LoopBuilder(HGraphBuilder* builder, |
| 1416 HValue* context, |
| 1417 Direction direction, |
| 1418 HValue* increment_amount); |
| 1419 |
| 1423 ~LoopBuilder() { | 1420 ~LoopBuilder() { |
| 1424 ASSERT(finished_); | 1421 ASSERT(finished_); |
| 1425 } | 1422 } |
| 1426 | 1423 |
| 1427 HValue* BeginBody( | 1424 HValue* BeginBody( |
| 1428 HValue* initial, | 1425 HValue* initial, |
| 1429 HValue* terminating, | 1426 HValue* terminating, |
| 1430 Token::Value token); | 1427 Token::Value token); |
| 1428 |
| 1429 void Break(); |
| 1430 |
| 1431 void EndBody(); | 1431 void EndBody(); |
| 1432 | 1432 |
| 1433 private: | 1433 private: |
| 1434 Zone* zone() { return builder_->zone(); } | 1434 Zone* zone() { return builder_->zone(); } |
| 1435 | 1435 |
| 1436 HGraphBuilder* builder_; | 1436 HGraphBuilder* builder_; |
| 1437 HValue* context_; | 1437 HValue* context_; |
| 1438 HValue* increment_amount_; |
| 1438 HInstruction* increment_; | 1439 HInstruction* increment_; |
| 1439 HPhi* phi_; | 1440 HPhi* phi_; |
| 1440 HBasicBlock* header_block_; | 1441 HBasicBlock* header_block_; |
| 1441 HBasicBlock* body_block_; | 1442 HBasicBlock* body_block_; |
| 1442 HBasicBlock* exit_block_; | 1443 HBasicBlock* exit_block_; |
| 1444 HBasicBlock* exit_trampoline_block_; |
| 1443 Direction direction_; | 1445 Direction direction_; |
| 1444 bool finished_; | 1446 bool finished_; |
| 1445 }; | 1447 }; |
| 1446 | 1448 |
| 1447 HValue* BuildNewElementsCapacity(HValue* old_capacity); | 1449 HValue* BuildNewElementsCapacity(HValue* old_capacity); |
| 1448 | 1450 |
| 1449 void BuildNewSpaceArrayCheck(HValue* length, | 1451 void BuildNewSpaceArrayCheck(HValue* length, |
| 1450 ElementsKind kind); | 1452 ElementsKind kind); |
| 1451 | 1453 |
| 1452 class JSArrayBuilder V8_FINAL { | 1454 class JSArrayBuilder V8_FINAL { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 void BuildCompareNil( | 1544 void BuildCompareNil( |
| 1543 HValue* value, | 1545 HValue* value, |
| 1544 Handle<Type> type, | 1546 Handle<Type> type, |
| 1545 int position, | 1547 int position, |
| 1546 HIfContinuation* continuation); | 1548 HIfContinuation* continuation); |
| 1547 | 1549 |
| 1548 HValue* BuildCreateAllocationMemento(HValue* previous_object, | 1550 HValue* BuildCreateAllocationMemento(HValue* previous_object, |
| 1549 int previous_object_size, | 1551 int previous_object_size, |
| 1550 HValue* payload); | 1552 HValue* payload); |
| 1551 | 1553 |
| 1552 void BuildConstantMapCheck(Handle<JSObject> constant, CompilationInfo* info); | 1554 HInstruction* BuildConstantMapCheck(Handle<JSObject> constant, |
| 1553 void BuildCheckPrototypeMaps(Handle<JSObject> prototype, | 1555 CompilationInfo* info); |
| 1554 Handle<JSObject> holder); | 1556 HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, |
| 1557 Handle<JSObject> holder); |
| 1555 | 1558 |
| 1556 HInstruction* BuildGetNativeContext(); | 1559 HInstruction* BuildGetNativeContext(); |
| 1557 HInstruction* BuildGetArrayFunction(); | 1560 HInstruction* BuildGetArrayFunction(); |
| 1558 | 1561 |
| 1559 private: | 1562 private: |
| 1560 HGraphBuilder(); | 1563 HGraphBuilder(); |
| 1561 | 1564 |
| 1562 void PadEnvironmentForContinuation(HBasicBlock* from, | 1565 void PadEnvironmentForContinuation(HBasicBlock* from, |
| 1563 HBasicBlock* continuation); | 1566 HBasicBlock* continuation); |
| 1564 | 1567 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>( | 1601 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>( |
| 1599 BailoutId id, | 1602 BailoutId id, |
| 1600 RemovableSimulate removable) { | 1603 RemovableSimulate removable) { |
| 1601 HSimulate* instr = current_block()->CreateSimulate(id, removable); | 1604 HSimulate* instr = current_block()->CreateSimulate(id, removable); |
| 1602 AddInstruction(instr); | 1605 AddInstruction(instr); |
| 1603 return instr; | 1606 return instr; |
| 1604 } | 1607 } |
| 1605 | 1608 |
| 1606 | 1609 |
| 1607 template<> | 1610 template<> |
| 1608 inline HInstruction* HGraphBuilder::NewUncasted<HLoadNamedField>( | |
| 1609 HValue* object, HObjectAccess access) { | |
| 1610 return NewUncasted<HLoadNamedField>(object, access, | |
| 1611 static_cast<HValue*>(NULL)); | |
| 1612 } | |
| 1613 | |
| 1614 | |
| 1615 template<> | |
| 1616 inline HInstruction* HGraphBuilder::AddUncasted<HLoadNamedField>( | |
| 1617 HValue* object, HObjectAccess access) { | |
| 1618 return AddUncasted<HLoadNamedField>(object, access, | |
| 1619 static_cast<HValue*>(NULL)); | |
| 1620 } | |
| 1621 | |
| 1622 | |
| 1623 template<> | |
| 1624 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { | 1611 inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) { |
| 1625 return AddUncasted<HSimulate>(id, FIXED_SIMULATE); | 1612 return AddUncasted<HSimulate>(id, FIXED_SIMULATE); |
| 1626 } | 1613 } |
| 1627 | 1614 |
| 1628 | 1615 |
| 1629 template<> | 1616 template<> |
| 1630 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { | 1617 inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) { |
| 1631 int num_parameters = graph()->info()->num_parameters(); | 1618 int num_parameters = graph()->info()->num_parameters(); |
| 1632 HValue* params = AddUncasted<HConstant>(num_parameters); | 1619 HValue* params = AddUncasted<HConstant>(num_parameters); |
| 1633 HReturn* return_instruction = New<HReturn>(value, params); | 1620 HReturn* return_instruction = New<HReturn>(value, params); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1997 HInstruction* BuildIncrement(bool returns_original_input, | 1984 HInstruction* BuildIncrement(bool returns_original_input, |
| 1998 CountOperation* expr); | 1985 CountOperation* expr); |
| 1999 HInstruction* BuildLoadKeyedGeneric(HValue* object, | 1986 HInstruction* BuildLoadKeyedGeneric(HValue* object, |
| 2000 HValue* key); | 1987 HValue* key); |
| 2001 | 1988 |
| 2002 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, | 1989 HInstruction* TryBuildConsolidatedElementLoad(HValue* object, |
| 2003 HValue* key, | 1990 HValue* key, |
| 2004 HValue* val, | 1991 HValue* val, |
| 2005 SmallMapList* maps); | 1992 SmallMapList* maps); |
| 2006 | 1993 |
| 1994 LoadKeyedHoleMode BuildKeyedHoleMode(Handle<Map> map); |
| 1995 |
| 2007 HInstruction* BuildMonomorphicElementAccess(HValue* object, | 1996 HInstruction* BuildMonomorphicElementAccess(HValue* object, |
| 2008 HValue* key, | 1997 HValue* key, |
| 2009 HValue* val, | 1998 HValue* val, |
| 2010 HValue* dependency, | 1999 HValue* dependency, |
| 2011 Handle<Map> map, | 2000 Handle<Map> map, |
| 2012 bool is_store, | 2001 bool is_store, |
| 2013 KeyedAccessStoreMode store_mode); | 2002 KeyedAccessStoreMode store_mode); |
| 2014 | 2003 |
| 2015 HValue* HandlePolymorphicElementAccess(HValue* object, | 2004 HValue* HandlePolymorphicElementAccess(HValue* object, |
| 2016 HValue* key, | 2005 HValue* key, |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2329 } | 2318 } |
| 2330 | 2319 |
| 2331 private: | 2320 private: |
| 2332 HGraphBuilder* builder_; | 2321 HGraphBuilder* builder_; |
| 2333 }; | 2322 }; |
| 2334 | 2323 |
| 2335 | 2324 |
| 2336 } } // namespace v8::internal | 2325 } } // namespace v8::internal |
| 2337 | 2326 |
| 2338 #endif // V8_HYDROGEN_H_ | 2327 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |