| 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); | 1294 HValue* BuildCheckMap(HValue* obj, Handle<Map> map); |
| 1266 HValue* BuildCheckString(HValue* string); | 1295 HValue* BuildCheckString(HValue* string); |
| 1267 HValue* BuildWrapReceiver(HValue* object, HValue* function); | 1296 HValue* BuildWrapReceiver(HValue* object, HValue* function); |
| 1268 | 1297 |
| 1269 // Building common constructs | 1298 // Building common constructs |
| 1270 HValue* BuildCheckForCapacityGrow(HValue* object, | 1299 HValue* BuildCheckForCapacityGrow(HValue* object, |
| 1271 HValue* elements, | 1300 HValue* elements, |
| 1272 ElementsKind kind, | 1301 ElementsKind kind, |
| 1273 HValue* length, | 1302 HValue* length, |
| 1274 HValue* key, | 1303 HValue* key, |
| 1275 bool is_js_array); | 1304 bool is_js_array, |
| 1305 bool is_store); |
| 1276 | 1306 |
| 1277 HValue* BuildCopyElementsOnWrite(HValue* object, | 1307 HValue* BuildCopyElementsOnWrite(HValue* object, |
| 1278 HValue* elements, | 1308 HValue* elements, |
| 1279 ElementsKind kind, | 1309 ElementsKind kind, |
| 1280 HValue* length); | 1310 HValue* length); |
| 1281 | 1311 |
| 1282 void BuildTransitionElementsKind(HValue* object, | 1312 void BuildTransitionElementsKind(HValue* object, |
| 1283 HValue* map, | 1313 HValue* map, |
| 1284 ElementsKind from_kind, | 1314 ElementsKind from_kind, |
| 1285 ElementsKind to_kind, | 1315 ElementsKind to_kind, |
| 1286 bool is_jsarray); | 1316 bool is_jsarray); |
| 1287 | 1317 |
| 1288 HValue* BuildNumberToString(HValue* object, Handle<Type> type); | 1318 HValue* BuildNumberToString(HValue* object, Handle<Type> type); |
| 1289 | 1319 |
| 1290 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, | 1320 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, |
| 1291 HValue* key); | 1321 HValue* key); |
| 1292 | 1322 |
| 1293 // Computes the size for a sequential string of the given length and encoding. | 1323 // Allocates a new object according with the given allocation properties. |
| 1294 HValue* BuildSeqStringSizeFor(HValue* length, | 1324 HAllocate* BuildAllocate(HValue* object_size, |
| 1295 String::Encoding encoding); | 1325 HType type, |
| 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); |
| 1296 // Copies characters from one sequential string to another. | 1335 // Copies characters from one sequential string to another. |
| 1297 void BuildCopySeqStringChars(HValue* src, | 1336 void BuildCopySeqStringChars(HValue* src, |
| 1298 HValue* src_offset, | 1337 HValue* src_offset, |
| 1299 String::Encoding src_encoding, | 1338 String::Encoding src_encoding, |
| 1300 HValue* dst, | 1339 HValue* dst, |
| 1301 HValue* dst_offset, | 1340 HValue* dst_offset, |
| 1302 String::Encoding dst_encoding, | 1341 String::Encoding dst_encoding, |
| 1303 HValue* length); | 1342 HValue* length); |
| 1304 // Both operands are non-empty strings. | 1343 // Both operands are non-empty strings. |
| 1305 HValue* BuildUncheckedStringAdd(HValue* left, | 1344 HValue* BuildUncheckedStringAdd(HValue* left, |
| 1306 HValue* right, | 1345 HValue* right, |
| 1307 PretenureFlag pretenure_flag); | 1346 HAllocationMode allocation_mode); |
| 1308 // Both operands are strings. | 1347 // Add two strings using allocation mode, validating type feedback. |
| 1309 HValue* BuildStringAdd(HValue* left, | 1348 HValue* BuildStringAdd(HValue* left, |
| 1310 HValue* right, | 1349 HValue* right, |
| 1311 PretenureFlag pretenure_flag); | 1350 HAllocationMode allocation_mode); |
| 1312 | 1351 |
| 1313 HInstruction* BuildUncheckedMonomorphicElementAccess( | 1352 HInstruction* BuildUncheckedMonomorphicElementAccess( |
| 1314 HValue* checked_object, | 1353 HValue* checked_object, |
| 1315 HValue* key, | 1354 HValue* key, |
| 1316 HValue* val, | 1355 HValue* val, |
| 1317 bool is_js_array, | 1356 bool is_js_array, |
| 1318 ElementsKind elements_kind, | 1357 ElementsKind elements_kind, |
| 1319 bool is_store, | 1358 bool is_store, |
| 1320 LoadKeyedHoleMode load_mode, | 1359 LoadKeyedHoleMode load_mode, |
| 1321 KeyedAccessStoreMode store_mode); | 1360 KeyedAccessStoreMode store_mode); |
| 1322 | 1361 |
| 1323 HInstruction* AddElementAccess( | 1362 HInstruction* AddElementAccess( |
| 1324 HValue* elements, | 1363 HValue* elements, |
| 1325 HValue* checked_key, | 1364 HValue* checked_key, |
| 1326 HValue* val, | 1365 HValue* val, |
| 1327 HValue* dependency, | 1366 HValue* dependency, |
| 1328 ElementsKind elements_kind, | 1367 ElementsKind elements_kind, |
| 1329 bool is_store, | 1368 bool is_store, |
| 1330 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); | 1369 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); |
| 1331 | 1370 |
| 1332 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); | 1371 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); |
| 1333 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); | 1372 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); |
| 1334 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value); | 1373 HInstruction* AddLoadStringInstanceType(HValue* string); |
| 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 } |
| 1335 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); | 1381 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); |
| 1336 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, | 1382 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, |
| 1337 Handle<Map> map) { | 1383 Handle<Map> map) { |
| 1338 HStoreNamedField* store_map = AddStoreMapConstant(object, map); | 1384 HStoreNamedField* store_map = AddStoreMapConstant(object, map); |
| 1339 store_map->SkipWriteBarrier(); | 1385 store_map->SkipWriteBarrier(); |
| 1340 return store_map; | 1386 return store_map; |
| 1341 } | 1387 } |
| 1342 HLoadNamedField* AddLoadElements(HValue* object); | 1388 HLoadNamedField* AddLoadElements(HValue* object); |
| 1343 | 1389 |
| 1344 bool MatchRotateRight(HValue* left, | 1390 bool MatchRotateRight(HValue* left, |
| 1345 HValue* right, | 1391 HValue* right, |
| 1346 HValue** operand, | 1392 HValue** operand, |
| 1347 HValue** shift_amount); | 1393 HValue** shift_amount); |
| 1348 | 1394 |
| 1349 HValue* BuildBinaryOperation(Token::Value op, | 1395 HValue* BuildBinaryOperation(Token::Value op, |
| 1350 HValue* left, | 1396 HValue* left, |
| 1351 HValue* right, | 1397 HValue* right, |
| 1352 Handle<Type> left_type, | 1398 Handle<Type> left_type, |
| 1353 Handle<Type> right_type, | 1399 Handle<Type> right_type, |
| 1354 Handle<Type> result_type, | 1400 Handle<Type> result_type, |
| 1355 Maybe<int> fixed_right_arg); | 1401 Maybe<int> fixed_right_arg, |
| 1402 HAllocationMode allocation_mode); |
| 1356 | 1403 |
| 1357 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); | 1404 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); |
| 1358 | 1405 |
| 1359 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); | 1406 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); |
| 1360 | 1407 |
| 1361 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); | 1408 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); |
| 1362 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); | 1409 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); |
| 1363 | 1410 |
| 1364 void FinishExitWithHardDeoptimization(const char* reason, | 1411 void FinishExitWithHardDeoptimization(const char* reason, |
| 1365 HBasicBlock* continuation); | 1412 HBasicBlock* continuation); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2316 bool TryCallPolymorphicAsMonomorphic(Call* expr, | 2363 bool TryCallPolymorphicAsMonomorphic(Call* expr, |
| 2317 HValue* receiver, | 2364 HValue* receiver, |
| 2318 SmallMapList* types, | 2365 SmallMapList* types, |
| 2319 Handle<String> name); | 2366 Handle<String> name); |
| 2320 void HandleLiteralCompareTypeof(CompareOperation* expr, | 2367 void HandleLiteralCompareTypeof(CompareOperation* expr, |
| 2321 Expression* sub_expr, | 2368 Expression* sub_expr, |
| 2322 Handle<String> check); | 2369 Handle<String> check); |
| 2323 void HandleLiteralCompareNil(CompareOperation* expr, | 2370 void HandleLiteralCompareNil(CompareOperation* expr, |
| 2324 Expression* sub_expr, | 2371 Expression* sub_expr, |
| 2325 NilValue nil); | 2372 NilValue nil); |
| 2373 HControlInstruction* BuildCompareInstruction(Token::Value op, |
| 2374 HValue* left, |
| 2375 HValue* right, |
| 2376 Handle<Type> left_type, |
| 2377 Handle<Type> right_type, |
| 2378 Handle<Type> combined_type, |
| 2379 int left_position, |
| 2380 int right_position, |
| 2381 BailoutId bailout_id); |
| 2326 | 2382 |
| 2327 HInstruction* BuildStringCharCodeAt(HValue* string, | 2383 HInstruction* BuildStringCharCodeAt(HValue* string, |
| 2328 HValue* index); | 2384 HValue* index); |
| 2329 HValue* BuildBinaryOperation(BinaryOperation* expr, | 2385 HValue* BuildBinaryOperation(BinaryOperation* expr, |
| 2330 HValue* left, | 2386 HValue* left, |
| 2331 HValue* right); | 2387 HValue* right); |
| 2332 HInstruction* BuildIncrement(bool returns_original_input, | 2388 HInstruction* BuildIncrement(bool returns_original_input, |
| 2333 CountOperation* expr); | 2389 CountOperation* expr); |
| 2334 HInstruction* BuildLoadKeyedGeneric(HValue* object, | 2390 HInstruction* BuildLoadKeyedGeneric(HValue* object, |
| 2335 HValue* key); | 2391 HValue* key); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2630 } | 2686 } |
| 2631 | 2687 |
| 2632 private: | 2688 private: |
| 2633 HGraphBuilder* builder_; | 2689 HGraphBuilder* builder_; |
| 2634 }; | 2690 }; |
| 2635 | 2691 |
| 2636 | 2692 |
| 2637 } } // namespace v8::internal | 2693 } } // namespace v8::internal |
| 2638 | 2694 |
| 2639 #endif // V8_HYDROGEN_H_ | 2695 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |