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

Side by Side Diff: src/hydrogen.h

Issue 23726041: Turn the NumberToStringStub into a hydrogen stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Using IfBuilder with JoinContinuation Created 7 years, 3 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
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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 934
935 HArgumentsObject* arguments_object_; 935 HArgumentsObject* arguments_object_;
936 HArgumentsElements* arguments_elements_; 936 HArgumentsElements* arguments_elements_;
937 937
938 FunctionState* outer_; 938 FunctionState* outer_;
939 }; 939 };
940 940
941 941
942 class HIfContinuation V8_FINAL { 942 class HIfContinuation V8_FINAL {
943 public: 943 public:
944 HIfContinuation() { continuation_captured_ = false; } 944 HIfContinuation() : continuation_captured_(false) {}
945 HIfContinuation(HBasicBlock* true_branch,
946 HBasicBlock* false_branch,
947 int position = RelocInfo::kNoPosition)
948 : continuation_captured_(true), true_branch_(true_branch),
949 false_branch_(false_branch), position_(position) {}
945 ~HIfContinuation() { ASSERT(!continuation_captured_); } 950 ~HIfContinuation() { ASSERT(!continuation_captured_); }
946 951
947 void Capture(HBasicBlock* true_branch, 952 void Capture(HBasicBlock* true_branch,
948 HBasicBlock* false_branch, 953 HBasicBlock* false_branch,
949 int position) { 954 int position) {
950 ASSERT(!continuation_captured_); 955 ASSERT(!continuation_captured_);
951 true_branch_ = true_branch; 956 true_branch_ = true_branch;
952 false_branch_ = false_branch; 957 false_branch_ = false_branch;
953 position_ = position; 958 position_ = position;
954 continuation_captured_ = true; 959 continuation_captured_ = true;
955 } 960 }
956 961
957 void Continue(HBasicBlock** true_branch, 962 void Continue(HBasicBlock** true_branch,
958 HBasicBlock** false_branch, 963 HBasicBlock** false_branch,
959 int* position) { 964 int* position) {
960 ASSERT(continuation_captured_); 965 ASSERT(continuation_captured_);
961 *true_branch = true_branch_; 966 *true_branch = true_branch_;
962 *false_branch = false_branch_; 967 *false_branch = false_branch_;
963 if (position != NULL) *position = position_; 968 if (position != NULL) *position = position_;
964 continuation_captured_ = false; 969 continuation_captured_ = false;
965 } 970 }
966 971
967 bool IsTrueReachable() { return true_branch_ != NULL; } 972 bool IsTrueReachable() { return true_branch_ != NULL; }
968 bool IsFalseReachable() { return false_branch_ != NULL; } 973 bool IsFalseReachable() { return false_branch_ != NULL; }
969 bool TrueAndFalseReachable() { 974 bool TrueAndFalseReachable() {
970 return IsTrueReachable() || IsFalseReachable(); 975 return IsTrueReachable() || IsFalseReachable();
971 } 976 }
972 977
978 HBasicBlock* true_branch() const { return true_branch_; }
979 HBasicBlock* false_branch() const { return false_branch_; }
980
981 private:
973 bool continuation_captured_; 982 bool continuation_captured_;
974 HBasicBlock* true_branch_; 983 HBasicBlock* true_branch_;
975 HBasicBlock* false_branch_; 984 HBasicBlock* false_branch_;
976 int position_; 985 int position_;
977 }; 986 };
978 987
979 988
980 class HGraphBuilder { 989 class HGraphBuilder {
981 public: 990 public:
982 explicit HGraphBuilder(CompilationInfo* info) 991 explicit HGraphBuilder(CompilationInfo* info)
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 HValue* elements, 1230 HValue* elements,
1222 ElementsKind kind, 1231 ElementsKind kind,
1223 HValue* length); 1232 HValue* length);
1224 1233
1225 void BuildTransitionElementsKind(HValue* object, 1234 void BuildTransitionElementsKind(HValue* object,
1226 HValue* map, 1235 HValue* map,
1227 ElementsKind from_kind, 1236 ElementsKind from_kind,
1228 ElementsKind to_kind, 1237 ElementsKind to_kind,
1229 bool is_jsarray); 1238 bool is_jsarray);
1230 1239
1240 // Do lookup in the number string cache. If the object is not found
1241 // in the cache, the false branch of the continuation is taken;
1242 // otherwise the true branch is taken and the returned value contains
1243 // the cache value for the object. The returned value must NOT be used
1244 // on the false branch.
1245 HValue* BuildLookupNumberStringCache(HValue* object,
1246 HIfContinuation* continuation);
1247 HValue* BuildNumberToString(HValue* number);
1248
1231 HInstruction* BuildUncheckedMonomorphicElementAccess( 1249 HInstruction* BuildUncheckedMonomorphicElementAccess(
1232 HValue* checked_object, 1250 HValue* checked_object,
1233 HValue* key, 1251 HValue* key,
1234 HValue* val, 1252 HValue* val,
1235 bool is_js_array, 1253 bool is_js_array,
1236 ElementsKind elements_kind, 1254 ElementsKind elements_kind,
1237 bool is_store, 1255 bool is_store,
1238 LoadKeyedHoleMode load_mode, 1256 LoadKeyedHoleMode load_mode,
1239 KeyedAccessStoreMode store_mode); 1257 KeyedAccessStoreMode store_mode);
1240 1258
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 1385
1368 template<class Condition, class P2, class P3> 1386 template<class Condition, class P2, class P3>
1369 Condition* AndIf(HValue* p1, P2 p2, P3 p3) { 1387 Condition* AndIf(HValue* p1, P2 p2, P3 p3) {
1370 And(); 1388 And();
1371 return If<Condition>(p1, p2, p3); 1389 return If<Condition>(p1, p2, p3);
1372 } 1390 }
1373 1391
1374 void Or(); 1392 void Or();
1375 void And(); 1393 void And();
1376 1394
1395 // Captures the current state of this IfBuilder in the specified
1396 // continuation and ends this IfBuilder.
1377 void CaptureContinuation(HIfContinuation* continuation); 1397 void CaptureContinuation(HIfContinuation* continuation);
1378 1398
1399 // Joins the specified continuation from this IfBuilder and ends this
1400 // IfBuilder. This appends a Goto instruction from the true branch of
1401 // this IfBuilder to the true branch of the continuation unless the
1402 // true branch of this IfBuilder is already finished. And vice versa
1403 // for the false branch.
1404 void JoinContinuation(HIfContinuation* continuation);
1405
1379 void Then(); 1406 void Then();
1380 void Else(); 1407 void Else();
1381 void End(); 1408 void End();
1382 1409
1383 void Deopt(const char* reason); 1410 void Deopt(const char* reason);
1384 void ElseDeopt(const char* reason) { 1411 void ElseDeopt(const char* reason) {
1385 Else(); 1412 Else();
1386 Deopt(reason); 1413 Deopt(reason);
1387 } 1414 }
1388 1415
(...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 } 2405 }
2379 2406
2380 private: 2407 private:
2381 HGraphBuilder* builder_; 2408 HGraphBuilder* builder_;
2382 }; 2409 };
2383 2410
2384 2411
2385 } } // namespace v8::internal 2412 } } // namespace v8::internal
2386 2413
2387 #endif // V8_HYDROGEN_H_ 2414 #endif // V8_HYDROGEN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698