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 | |
1027 class HGraphBuilder { | 998 class HGraphBuilder { |
1028 public: | 999 public: |
1029 explicit HGraphBuilder(CompilationInfo* info) | 1000 explicit HGraphBuilder(CompilationInfo* info) |
1030 : info_(info), | 1001 : info_(info), |
1031 graph_(NULL), | 1002 graph_(NULL), |
1032 current_block_(NULL), | 1003 current_block_(NULL), |
1033 position_(RelocInfo::kNoPosition) {} | 1004 position_(RelocInfo::kNoPosition) {} |
1034 virtual ~HGraphBuilder() {} | 1005 virtual ~HGraphBuilder() {} |
1035 | 1006 |
1036 HBasicBlock* current_block() const { return current_block_; } | 1007 HBasicBlock* current_block() const { return current_block_; } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 HValue* map, | 1284 HValue* map, |
1314 ElementsKind from_kind, | 1285 ElementsKind from_kind, |
1315 ElementsKind to_kind, | 1286 ElementsKind to_kind, |
1316 bool is_jsarray); | 1287 bool is_jsarray); |
1317 | 1288 |
1318 HValue* BuildNumberToString(HValue* object, Handle<Type> type); | 1289 HValue* BuildNumberToString(HValue* object, Handle<Type> type); |
1319 | 1290 |
1320 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, | 1291 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, |
1321 HValue* key); | 1292 HValue* key); |
1322 | 1293 |
1323 // Allocates a new object according with the given allocation properties. | 1294 // Computes the size for a sequential string of the given length and encoding. |
1324 HAllocate* BuildAllocate(HValue* object_size, | 1295 HValue* BuildSeqStringSizeFor(HValue* length, |
1325 HType type, | 1296 String::Encoding encoding); |
1326 InstanceType instance_type, | |
1327 HAllocationMode allocation_mode); | |
1328 // Computes the sum of two string lengths, taking care of overflow handling. | |
1329 HValue* BuildAddStringLengths(HValue* left_length, HValue* right_length); | |
1330 // Creates a cons string using the two input strings. | |
1331 HValue* BuildCreateConsString(HValue* length, | |
1332 HValue* left, | |
1333 HValue* right, | |
1334 HAllocationMode allocation_mode); | |
1335 // Copies characters from one sequential string to another. | 1297 // Copies characters from one sequential string to another. |
1336 void BuildCopySeqStringChars(HValue* src, | 1298 void BuildCopySeqStringChars(HValue* src, |
1337 HValue* src_offset, | 1299 HValue* src_offset, |
1338 String::Encoding src_encoding, | 1300 String::Encoding src_encoding, |
1339 HValue* dst, | 1301 HValue* dst, |
1340 HValue* dst_offset, | 1302 HValue* dst_offset, |
1341 String::Encoding dst_encoding, | 1303 String::Encoding dst_encoding, |
1342 HValue* length); | 1304 HValue* length); |
1343 // Both operands are non-empty strings. | 1305 // Both operands are non-empty strings. |
1344 HValue* BuildUncheckedStringAdd(HValue* left, | 1306 HValue* BuildUncheckedStringAdd(HValue* left, |
1345 HValue* right, | 1307 HValue* right, |
1346 HAllocationMode allocation_mode); | 1308 PretenureFlag pretenure_flag); |
1347 // Add two strings using allocation mode, validating type feedback. | 1309 // Both operands are strings. |
1348 HValue* BuildStringAdd(HValue* left, | 1310 HValue* BuildStringAdd(HValue* left, |
1349 HValue* right, | 1311 HValue* right, |
1350 HAllocationMode allocation_mode); | 1312 PretenureFlag pretenure_flag); |
1351 | 1313 |
1352 HInstruction* BuildUncheckedMonomorphicElementAccess( | 1314 HInstruction* BuildUncheckedMonomorphicElementAccess( |
1353 HValue* checked_object, | 1315 HValue* checked_object, |
1354 HValue* key, | 1316 HValue* key, |
1355 HValue* val, | 1317 HValue* val, |
1356 bool is_js_array, | 1318 bool is_js_array, |
1357 ElementsKind elements_kind, | 1319 ElementsKind elements_kind, |
1358 bool is_store, | 1320 bool is_store, |
1359 LoadKeyedHoleMode load_mode, | 1321 LoadKeyedHoleMode load_mode, |
1360 KeyedAccessStoreMode store_mode); | 1322 KeyedAccessStoreMode store_mode); |
1361 | 1323 |
1362 HInstruction* AddElementAccess( | 1324 HInstruction* AddElementAccess( |
1363 HValue* elements, | 1325 HValue* elements, |
1364 HValue* checked_key, | 1326 HValue* checked_key, |
1365 HValue* val, | 1327 HValue* val, |
1366 HValue* dependency, | 1328 HValue* dependency, |
1367 ElementsKind elements_kind, | 1329 ElementsKind elements_kind, |
1368 bool is_store, | 1330 bool is_store, |
1369 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); | 1331 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); |
1370 | 1332 |
1371 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); | 1333 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); |
1372 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); | 1334 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); |
1373 HInstruction* AddLoadStringInstanceType(HValue* string); | 1335 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value); |
1374 HInstruction* AddLoadStringLength(HValue* string); | |
1375 HStoreNamedField* AddStoreMapNoWriteBarrier(HValue* object, HValue* map) { | |
1376 HStoreNamedField* store_map = Add<HStoreNamedField>( | |
1377 object, HObjectAccess::ForMap(), map); | |
1378 store_map->SkipWriteBarrier(); | |
1379 return store_map; | |
1380 } | |
1381 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); | 1336 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); |
1382 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, | 1337 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, |
1383 Handle<Map> map) { | 1338 Handle<Map> map) { |
1384 HStoreNamedField* store_map = AddStoreMapConstant(object, map); | 1339 HStoreNamedField* store_map = AddStoreMapConstant(object, map); |
1385 store_map->SkipWriteBarrier(); | 1340 store_map->SkipWriteBarrier(); |
1386 return store_map; | 1341 return store_map; |
1387 } | 1342 } |
1388 HLoadNamedField* AddLoadElements(HValue* object); | 1343 HLoadNamedField* AddLoadElements(HValue* object); |
1389 | 1344 |
1390 bool MatchRotateRight(HValue* left, | 1345 bool MatchRotateRight(HValue* left, |
1391 HValue* right, | 1346 HValue* right, |
1392 HValue** operand, | 1347 HValue** operand, |
1393 HValue** shift_amount); | 1348 HValue** shift_amount); |
1394 | 1349 |
1395 HValue* BuildBinaryOperation(Token::Value op, | 1350 HValue* BuildBinaryOperation(Token::Value op, |
1396 HValue* left, | 1351 HValue* left, |
1397 HValue* right, | 1352 HValue* right, |
1398 Handle<Type> left_type, | 1353 Handle<Type> left_type, |
1399 Handle<Type> right_type, | 1354 Handle<Type> right_type, |
1400 Handle<Type> result_type, | 1355 Handle<Type> result_type, |
1401 Maybe<int> fixed_right_arg, | 1356 Maybe<int> fixed_right_arg); |
1402 HAllocationMode allocation_mode); | |
1403 | 1357 |
1404 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1358 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
1405 | 1359 |
1406 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1360 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
1407 | 1361 |
1408 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); | 1362 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); |
1409 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1363 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
1410 | 1364 |
1411 void FinishExitWithHardDeoptimization(const char* reason, | 1365 void FinishExitWithHardDeoptimization(const char* reason, |
1412 HBasicBlock* continuation); | 1366 HBasicBlock* continuation); |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 } | 2640 } |
2687 | 2641 |
2688 private: | 2642 private: |
2689 HGraphBuilder* builder_; | 2643 HGraphBuilder* builder_; |
2690 }; | 2644 }; |
2691 | 2645 |
2692 | 2646 |
2693 } } // namespace v8::internal | 2647 } } // namespace v8::internal |
2694 | 2648 |
2695 #endif // V8_HYDROGEN_H_ | 2649 #endif // V8_HYDROGEN_H_ |
OLD | NEW |