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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 HBasicBlock* true_branch() const { return true_branch_; } | 988 HBasicBlock* true_branch() const { return true_branch_; } |
989 HBasicBlock* false_branch() const { return false_branch_; } | 989 HBasicBlock* false_branch() const { return false_branch_; } |
990 | 990 |
991 private: | 991 private: |
992 bool continuation_captured_; | 992 bool continuation_captured_; |
993 HBasicBlock* true_branch_; | 993 HBasicBlock* true_branch_; |
994 HBasicBlock* false_branch_; | 994 HBasicBlock* false_branch_; |
995 }; | 995 }; |
996 | 996 |
997 | 997 |
| 998 class HAllocationMode V8_FINAL BASE_EMBEDDED { |
| 999 public: |
| 1000 explicit HAllocationMode(Handle<AllocationSite> feedback_site) |
| 1001 : current_site_(NULL), feedback_site_(feedback_site), |
| 1002 pretenure_flag_(NOT_TENURED) {} |
| 1003 explicit HAllocationMode(HValue* current_site) |
| 1004 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {} |
| 1005 explicit HAllocationMode(PretenureFlag pretenure_flag) |
| 1006 : current_site_(NULL), pretenure_flag_(pretenure_flag) {} |
| 1007 |
| 1008 HValue* current_site() const { return current_site_; } |
| 1009 Handle<AllocationSite> feedback_site() const { return feedback_site_; } |
| 1010 |
| 1011 bool CreateAllocationMementos() const V8_WARN_UNUSED_RESULT { |
| 1012 return current_site() != NULL; |
| 1013 } |
| 1014 |
| 1015 PretenureFlag GetPretenureMode() const V8_WARN_UNUSED_RESULT { |
| 1016 if (!feedback_site().is_null()) return feedback_site()->GetPretenureMode(); |
| 1017 return pretenure_flag_; |
| 1018 } |
| 1019 |
| 1020 private: |
| 1021 HValue* current_site_; |
| 1022 Handle<AllocationSite> feedback_site_; |
| 1023 PretenureFlag pretenure_flag_; |
| 1024 }; |
| 1025 |
| 1026 |
998 class HGraphBuilder { | 1027 class HGraphBuilder { |
999 public: | 1028 public: |
1000 explicit HGraphBuilder(CompilationInfo* info) | 1029 explicit HGraphBuilder(CompilationInfo* info) |
1001 : info_(info), | 1030 : info_(info), |
1002 graph_(NULL), | 1031 graph_(NULL), |
1003 current_block_(NULL), | 1032 current_block_(NULL), |
1004 position_(RelocInfo::kNoPosition) {} | 1033 position_(RelocInfo::kNoPosition) {} |
1005 virtual ~HGraphBuilder() {} | 1034 virtual ~HGraphBuilder() {} |
1006 | 1035 |
1007 HBasicBlock* current_block() const { return current_block_; } | 1036 HBasicBlock* current_block() const { return current_block_; } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 HValue* map, | 1312 HValue* map, |
1284 ElementsKind from_kind, | 1313 ElementsKind from_kind, |
1285 ElementsKind to_kind, | 1314 ElementsKind to_kind, |
1286 bool is_jsarray); | 1315 bool is_jsarray); |
1287 | 1316 |
1288 HValue* BuildNumberToString(HValue* object, Handle<Type> type); | 1317 HValue* BuildNumberToString(HValue* object, Handle<Type> type); |
1289 | 1318 |
1290 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, | 1319 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, |
1291 HValue* key); | 1320 HValue* key); |
1292 | 1321 |
1293 // Computes the size for a sequential string of the given length and encoding. | 1322 // Allocates a new object according with the given allocation properties. |
1294 HValue* BuildSeqStringSizeFor(HValue* length, | 1323 HAllocate* BuildAllocate(HValue* object_size, |
1295 String::Encoding encoding); | 1324 HType type, |
| 1325 InstanceType instance_type, |
| 1326 HAllocationMode allocation_mode); |
| 1327 // Computes the sum of two string lengths, taking care of overflow handling. |
| 1328 HValue* BuildAddStringLengths(HValue* left_length, HValue* right_length); |
| 1329 // Creates a cons string using the two input strings. |
| 1330 HValue* BuildCreateConsString(HValue* length, |
| 1331 HValue* left, |
| 1332 HValue* right, |
| 1333 HAllocationMode allocation_mode); |
1296 // Copies characters from one sequential string to another. | 1334 // Copies characters from one sequential string to another. |
1297 void BuildCopySeqStringChars(HValue* src, | 1335 void BuildCopySeqStringChars(HValue* src, |
1298 HValue* src_offset, | 1336 HValue* src_offset, |
1299 String::Encoding src_encoding, | 1337 String::Encoding src_encoding, |
1300 HValue* dst, | 1338 HValue* dst, |
1301 HValue* dst_offset, | 1339 HValue* dst_offset, |
1302 String::Encoding dst_encoding, | 1340 String::Encoding dst_encoding, |
1303 HValue* length); | 1341 HValue* length); |
1304 // Both operands are non-empty strings. | 1342 // Both operands are non-empty strings. |
1305 HValue* BuildUncheckedStringAdd(HValue* left, | 1343 HValue* BuildUncheckedStringAdd(HValue* left, |
1306 HValue* right, | 1344 HValue* right, |
1307 PretenureFlag pretenure_flag); | 1345 HAllocationMode allocation_mode); |
1308 // Both operands are strings. | 1346 // Add two strings using allocation mode, validating type feedback. |
1309 HValue* BuildStringAdd(HValue* left, | 1347 HValue* BuildStringAdd(HValue* left, |
1310 HValue* right, | 1348 HValue* right, |
1311 PretenureFlag pretenure_flag); | 1349 HAllocationMode allocation_mode); |
1312 | 1350 |
1313 HInstruction* BuildUncheckedMonomorphicElementAccess( | 1351 HInstruction* BuildUncheckedMonomorphicElementAccess( |
1314 HValue* checked_object, | 1352 HValue* checked_object, |
1315 HValue* key, | 1353 HValue* key, |
1316 HValue* val, | 1354 HValue* val, |
1317 bool is_js_array, | 1355 bool is_js_array, |
1318 ElementsKind elements_kind, | 1356 ElementsKind elements_kind, |
1319 bool is_store, | 1357 bool is_store, |
1320 LoadKeyedHoleMode load_mode, | 1358 LoadKeyedHoleMode load_mode, |
1321 KeyedAccessStoreMode store_mode); | 1359 KeyedAccessStoreMode store_mode); |
1322 | 1360 |
1323 HInstruction* AddElementAccess( | 1361 HInstruction* AddElementAccess( |
1324 HValue* elements, | 1362 HValue* elements, |
1325 HValue* checked_key, | 1363 HValue* checked_key, |
1326 HValue* val, | 1364 HValue* val, |
1327 HValue* dependency, | 1365 HValue* dependency, |
1328 ElementsKind elements_kind, | 1366 ElementsKind elements_kind, |
1329 bool is_store, | 1367 bool is_store, |
1330 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); | 1368 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); |
1331 | 1369 |
1332 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); | 1370 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); |
1333 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); | 1371 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); |
1334 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value); | 1372 HInstruction* AddLoadStringInstanceType(HValue* string); |
| 1373 HInstruction* AddLoadStringLength(HValue* string); |
| 1374 HStoreNamedField* AddStoreMapNoWriteBarrier(HValue* object, HValue* map) { |
| 1375 HStoreNamedField* store_map = Add<HStoreNamedField>( |
| 1376 object, HObjectAccess::ForMap(), map); |
| 1377 store_map->SkipWriteBarrier(); |
| 1378 return store_map; |
| 1379 } |
1335 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); | 1380 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); |
1336 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, | 1381 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, |
1337 Handle<Map> map) { | 1382 Handle<Map> map) { |
1338 HStoreNamedField* store_map = AddStoreMapConstant(object, map); | 1383 HStoreNamedField* store_map = AddStoreMapConstant(object, map); |
1339 store_map->SkipWriteBarrier(); | 1384 store_map->SkipWriteBarrier(); |
1340 return store_map; | 1385 return store_map; |
1341 } | 1386 } |
1342 HLoadNamedField* AddLoadElements(HValue* object); | 1387 HLoadNamedField* AddLoadElements(HValue* object); |
1343 | 1388 |
1344 bool MatchRotateRight(HValue* left, | 1389 bool MatchRotateRight(HValue* left, |
1345 HValue* right, | 1390 HValue* right, |
1346 HValue** operand, | 1391 HValue** operand, |
1347 HValue** shift_amount); | 1392 HValue** shift_amount); |
1348 | 1393 |
1349 HValue* BuildBinaryOperation(Token::Value op, | 1394 HValue* BuildBinaryOperation(Token::Value op, |
1350 HValue* left, | 1395 HValue* left, |
1351 HValue* right, | 1396 HValue* right, |
1352 Handle<Type> left_type, | 1397 Handle<Type> left_type, |
1353 Handle<Type> right_type, | 1398 Handle<Type> right_type, |
1354 Handle<Type> result_type, | 1399 Handle<Type> result_type, |
1355 Maybe<int> fixed_right_arg); | 1400 Maybe<int> fixed_right_arg, |
| 1401 HAllocationMode allocation_mode); |
1356 | 1402 |
1357 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1403 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
1358 | 1404 |
1359 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1405 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
1360 | 1406 |
1361 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); | 1407 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); |
1362 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1408 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
1363 | 1409 |
1364 void FinishExitWithHardDeoptimization(const char* reason, | 1410 void FinishExitWithHardDeoptimization(const char* reason, |
1365 HBasicBlock* continuation); | 1411 HBasicBlock* continuation); |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 } | 2676 } |
2631 | 2677 |
2632 private: | 2678 private: |
2633 HGraphBuilder* builder_; | 2679 HGraphBuilder* builder_; |
2634 }; | 2680 }; |
2635 | 2681 |
2636 | 2682 |
2637 } } // namespace v8::internal | 2683 } } // namespace v8::internal |
2638 | 2684 |
2639 #endif // V8_HYDROGEN_H_ | 2685 #endif // V8_HYDROGEN_H_ |
OLD | NEW |