Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/hydrogen.h

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 HValue* map, 1313 HValue* map,
1285 ElementsKind from_kind, 1314 ElementsKind from_kind,
1286 ElementsKind to_kind, 1315 ElementsKind to_kind,
1287 bool is_jsarray); 1316 bool is_jsarray);
1288 1317
1289 HValue* BuildNumberToString(HValue* object, Handle<Type> type); 1318 HValue* BuildNumberToString(HValue* object, Handle<Type> type);
1290 1319
1291 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver, 1320 HValue* BuildUncheckedDictionaryElementLoad(HValue* receiver,
1292 HValue* key); 1321 HValue* key);
1293 1322
1294 // Computes the size for a sequential string of the given length and encoding. 1323 // Allocates a new object according with the given allocation properties.
1295 HValue* BuildSeqStringSizeFor(HValue* length, 1324 HAllocate* BuildAllocate(HValue* object_size,
1296 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);
1297 // Copies characters from one sequential string to another. 1335 // Copies characters from one sequential string to another.
1298 void BuildCopySeqStringChars(HValue* src, 1336 void BuildCopySeqStringChars(HValue* src,
1299 HValue* src_offset, 1337 HValue* src_offset,
1300 String::Encoding src_encoding, 1338 String::Encoding src_encoding,
1301 HValue* dst, 1339 HValue* dst,
1302 HValue* dst_offset, 1340 HValue* dst_offset,
1303 String::Encoding dst_encoding, 1341 String::Encoding dst_encoding,
1304 HValue* length); 1342 HValue* length);
1305 // Both operands are non-empty strings. 1343 // Both operands are non-empty strings.
1306 HValue* BuildUncheckedStringAdd(HValue* left, 1344 HValue* BuildUncheckedStringAdd(HValue* left,
1307 HValue* right, 1345 HValue* right,
1308 PretenureFlag pretenure_flag); 1346 HAllocationMode allocation_mode);
1309 // Both operands are strings. 1347 // Add two strings using allocation mode, validating type feedback.
1310 HValue* BuildStringAdd(HValue* left, 1348 HValue* BuildStringAdd(HValue* left,
1311 HValue* right, 1349 HValue* right,
1312 PretenureFlag pretenure_flag); 1350 HAllocationMode allocation_mode);
1313 1351
1314 HInstruction* BuildUncheckedMonomorphicElementAccess( 1352 HInstruction* BuildUncheckedMonomorphicElementAccess(
1315 HValue* checked_object, 1353 HValue* checked_object,
1316 HValue* key, 1354 HValue* key,
1317 HValue* val, 1355 HValue* val,
1318 bool is_js_array, 1356 bool is_js_array,
1319 ElementsKind elements_kind, 1357 ElementsKind elements_kind,
1320 bool is_store, 1358 bool is_store,
1321 LoadKeyedHoleMode load_mode, 1359 LoadKeyedHoleMode load_mode,
1322 KeyedAccessStoreMode store_mode); 1360 KeyedAccessStoreMode store_mode);
1323 1361
1324 HInstruction* AddElementAccess( 1362 HInstruction* AddElementAccess(
1325 HValue* elements, 1363 HValue* elements,
1326 HValue* checked_key, 1364 HValue* checked_key,
1327 HValue* val, 1365 HValue* val,
1328 HValue* dependency, 1366 HValue* dependency,
1329 ElementsKind elements_kind, 1367 ElementsKind elements_kind,
1330 bool is_store, 1368 bool is_store,
1331 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE); 1369 LoadKeyedHoleMode load_mode = NEVER_RETURN_HOLE);
1332 1370
1333 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); 1371 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access);
1334 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access); 1372 HInstruction* AddLoadNamedField(HValue* object, HObjectAccess access);
1335 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 }
1336 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map); 1381 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map> map);
1337 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object, 1382 HStoreNamedField* AddStoreMapConstantNoWriteBarrier(HValue* object,
1338 Handle<Map> map) { 1383 Handle<Map> map) {
1339 HStoreNamedField* store_map = AddStoreMapConstant(object, map); 1384 HStoreNamedField* store_map = AddStoreMapConstant(object, map);
1340 store_map->SkipWriteBarrier(); 1385 store_map->SkipWriteBarrier();
1341 return store_map; 1386 return store_map;
1342 } 1387 }
1343 HLoadNamedField* AddLoadElements(HValue* object); 1388 HLoadNamedField* AddLoadElements(HValue* object);
1344 1389
1345 bool MatchRotateRight(HValue* left, 1390 bool MatchRotateRight(HValue* left,
1346 HValue* right, 1391 HValue* right,
1347 HValue** operand, 1392 HValue** operand,
1348 HValue** shift_amount); 1393 HValue** shift_amount);
1349 1394
1350 HValue* BuildBinaryOperation(Token::Value op, 1395 HValue* BuildBinaryOperation(Token::Value op,
1351 HValue* left, 1396 HValue* left,
1352 HValue* right, 1397 HValue* right,
1353 Handle<Type> left_type, 1398 Handle<Type> left_type,
1354 Handle<Type> right_type, 1399 Handle<Type> right_type,
1355 Handle<Type> result_type, 1400 Handle<Type> result_type,
1356 Maybe<int> fixed_right_arg); 1401 Maybe<int> fixed_right_arg,
1402 HAllocationMode allocation_mode);
1357 1403
1358 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); 1404 HLoadNamedField* AddLoadFixedArrayLength(HValue *object);
1359 1405
1360 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); 1406 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
1361 1407
1362 HValue* EnforceNumberType(HValue* number, Handle<Type> expected); 1408 HValue* EnforceNumberType(HValue* number, Handle<Type> expected);
1363 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); 1409 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected);
1364 1410
1365 void FinishExitWithHardDeoptimization(const char* reason, 1411 void FinishExitWithHardDeoptimization(const char* reason,
1366 HBasicBlock* continuation); 1412 HBasicBlock* continuation);
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 } 2686 }
2641 2687
2642 private: 2688 private:
2643 HGraphBuilder* builder_; 2689 HGraphBuilder* builder_;
2644 }; 2690 };
2645 2691
2646 2692
2647 } } // namespace v8::internal 2693 } } // namespace v8::internal
2648 2694
2649 #endif // V8_HYDROGEN_H_ 2695 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698