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

Side by Side Diff: src/hydrogen.h

Issue 146213004: A64: Synchronize with r16849. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/heap-snapshot-generator.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 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 HValue* dependency, 1253 HValue* dependency,
1254 ElementsKind elements_kind, 1254 ElementsKind elements_kind,
1255 bool is_store, 1255 bool is_store,
1256 LoadKeyedHoleMode load_mode, 1256 LoadKeyedHoleMode load_mode,
1257 KeyedAccessStoreMode store_mode); 1257 KeyedAccessStoreMode store_mode);
1258 1258
1259 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access); 1259 HLoadNamedField* BuildLoadNamedField(HValue* object, HObjectAccess access);
1260 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value); 1260 HInstruction* BuildLoadStringLength(HValue* object, HValue* checked_value);
1261 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map>); 1261 HStoreNamedField* AddStoreMapConstant(HValue* object, Handle<Map>);
1262 HLoadNamedField* AddLoadElements(HValue* object); 1262 HLoadNamedField* AddLoadElements(HValue* object);
1263
1264 bool MatchRotateRight(HValue* left,
1265 HValue* right,
1266 HValue** operand,
1267 HValue** shift_amount);
1268
1269 HInstruction* BuildBinaryOperation(Token::Value op,
1270 HValue* left,
1271 HValue* right,
1272 Handle<Type> left_type,
1273 Handle<Type> right_type,
1274 Handle<Type> result_type,
1275 Maybe<int> fixed_right_arg,
1276 HValue* context);
1277
1263 HLoadNamedField* AddLoadFixedArrayLength(HValue *object); 1278 HLoadNamedField* AddLoadFixedArrayLength(HValue *object);
1264 1279
1265 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); 1280 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
1266 1281
1282 HValue* EnforceNumberType(HValue* number, Handle<Type> expected);
1267 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected); 1283 HValue* TruncateToNumber(HValue* value, Handle<Type>* expected);
1268 1284
1269 void PushAndAdd(HInstruction* instr); 1285 void PushAndAdd(HInstruction* instr);
1270 1286
1271 void FinishExitWithHardDeoptimization(const char* reason, 1287 void FinishExitWithHardDeoptimization(const char* reason,
1272 HBasicBlock* continuation); 1288 HBasicBlock* continuation);
1273 1289
1274 void AddIncrementCounter(StatsCounter* counter); 1290 void AddIncrementCounter(StatsCounter* counter);
1275 1291
1276 class IfBuilder V8_FINAL { 1292 class IfBuilder V8_FINAL {
1277 public: 1293 public:
1278 explicit IfBuilder(HGraphBuilder* builder, 1294 explicit IfBuilder(HGraphBuilder* builder,
1279 int position = RelocInfo::kNoPosition); 1295 int position = RelocInfo::kNoPosition);
1280 IfBuilder(HGraphBuilder* builder, 1296 IfBuilder(HGraphBuilder* builder,
1281 HIfContinuation* continuation); 1297 HIfContinuation* continuation);
1282 1298
1283 ~IfBuilder() { 1299 ~IfBuilder() {
1284 if (!finished_) End(); 1300 if (!finished_) End();
1285 } 1301 }
1286 1302
1287 template<class Condition> 1303 template<class Condition>
1288 HInstruction* If(HValue *p) { 1304 Condition* If(HValue *p) {
1289 HControlInstruction* compare = new(zone()) Condition(p); 1305 Condition* compare = builder()->New<Condition>(p);
1290 AddCompare(compare); 1306 AddCompare(compare);
1291 return compare; 1307 return compare;
1292 } 1308 }
1293 1309
1294 template<class Condition, class P2> 1310 template<class Condition, class P2>
1295 HInstruction* If(HValue* p1, P2 p2) { 1311 Condition* If(HValue* p1, P2 p2) {
1296 HControlInstruction* compare = new(zone()) Condition(p1, p2); 1312 Condition* compare = builder()->New<Condition>(p1, p2);
1297 AddCompare(compare); 1313 AddCompare(compare);
1298 return compare; 1314 return compare;
1299 } 1315 }
1300 1316
1301 template<class Condition, class P2, class P3> 1317 template<class Condition, class P2, class P3>
1302 HInstruction* If(HValue* p1, P2 p2, P3 p3) { 1318 Condition* If(HValue* p1, P2 p2, P3 p3) {
1303 HControlInstruction* compare = new(zone()) Condition(p1, p2, p3); 1319 Condition* compare = builder()->New<Condition>(p1, p2, p3);
1304 AddCompare(compare); 1320 AddCompare(compare);
1305 return compare; 1321 return compare;
1306 } 1322 }
1307 1323
1324 template<class Condition>
1325 Condition* IfNot(HValue* p) {
1326 Condition* compare = If<Condition>(p);
1327 compare->Not();
1328 return compare;
1329 }
1330
1308 template<class Condition, class P2> 1331 template<class Condition, class P2>
1309 HInstruction* IfNot(HValue* p1, P2 p2) { 1332 Condition* IfNot(HValue* p1, P2 p2) {
1310 HControlInstruction* compare = new(zone()) Condition(p1, p2); 1333 Condition* compare = If<Condition>(p1, p2);
1311 AddCompare(compare); 1334 compare->Not();
1312 HBasicBlock* block0 = compare->SuccessorAt(0);
1313 HBasicBlock* block1 = compare->SuccessorAt(1);
1314 compare->SetSuccessorAt(0, block1);
1315 compare->SetSuccessorAt(1, block0);
1316 return compare; 1335 return compare;
1317 } 1336 }
1318 1337
1319 template<class Condition, class P2, class P3> 1338 template<class Condition, class P2, class P3>
1320 HInstruction* IfNot(HValue* p1, P2 p2, P3 p3) { 1339 Condition* IfNot(HValue* p1, P2 p2, P3 p3) {
1321 HControlInstruction* compare = new(zone()) Condition(p1, p2, p3); 1340 Condition* compare = If<Condition>(p1, p2, p3);
1322 AddCompare(compare); 1341 compare->Not();
1323 HBasicBlock* block0 = compare->SuccessorAt(0);
1324 HBasicBlock* block1 = compare->SuccessorAt(1);
1325 compare->SetSuccessorAt(0, block1);
1326 compare->SetSuccessorAt(1, block0);
1327 return compare; 1342 return compare;
1328 } 1343 }
1329 1344
1330 template<class Condition> 1345 template<class Condition>
1331 HInstruction* OrIf(HValue *p) { 1346 Condition* OrIf(HValue *p) {
1332 Or(); 1347 Or();
1333 return If<Condition>(p); 1348 return If<Condition>(p);
1334 } 1349 }
1335 1350
1336 template<class Condition, class P2> 1351 template<class Condition, class P2>
1337 HInstruction* OrIf(HValue* p1, P2 p2) { 1352 Condition* OrIf(HValue* p1, P2 p2) {
1338 Or(); 1353 Or();
1339 return If<Condition>(p1, p2); 1354 return If<Condition>(p1, p2);
1340 } 1355 }
1341 1356
1342 template<class Condition, class P2, class P3> 1357 template<class Condition, class P2, class P3>
1343 HInstruction* OrIf(HValue* p1, P2 p2, P3 p3) { 1358 Condition* OrIf(HValue* p1, P2 p2, P3 p3) {
1344 Or(); 1359 Or();
1345 return If<Condition>(p1, p2, p3); 1360 return If<Condition>(p1, p2, p3);
1346 } 1361 }
1347 1362
1348 template<class Condition> 1363 template<class Condition>
1349 HInstruction* AndIf(HValue *p) { 1364 Condition* AndIf(HValue *p) {
1350 And(); 1365 And();
1351 return If<Condition>(p); 1366 return If<Condition>(p);
1352 } 1367 }
1353 1368
1354 template<class Condition, class P2> 1369 template<class Condition, class P2>
1355 HInstruction* AndIf(HValue* p1, P2 p2) { 1370 Condition* AndIf(HValue* p1, P2 p2) {
1356 And(); 1371 And();
1357 return If<Condition>(p1, p2); 1372 return If<Condition>(p1, p2);
1358 } 1373 }
1359 1374
1360 template<class Condition, class P2, class P3> 1375 template<class Condition, class P2, class P3>
1361 HInstruction* AndIf(HValue* p1, P2 p2, P3 p3) { 1376 Condition* AndIf(HValue* p1, P2 p2, P3 p3) {
1362 And(); 1377 And();
1363 return If<Condition>(p1, p2, p3); 1378 return If<Condition>(p1, p2, p3);
1364 } 1379 }
1365 1380
1366 void Or(); 1381 void Or();
1367 void And(); 1382 void And();
1368 1383
1369 void CaptureContinuation(HIfContinuation* continuation); 1384 void CaptureContinuation(HIfContinuation* continuation);
1370 1385
1371 void Then(); 1386 void Then();
1372 void Else(); 1387 void Else();
1373 void End(); 1388 void End();
1374 1389
1375 void Deopt(const char* reason); 1390 void Deopt(const char* reason);
1376 void ElseDeopt(const char* reason) { 1391 void ElseDeopt(const char* reason) {
1377 Else(); 1392 Else();
1378 Deopt(reason); 1393 Deopt(reason);
1379 } 1394 }
1380 1395
1381 void Return(HValue* value); 1396 void Return(HValue* value);
1382 1397
1383 private: 1398 private:
1384 void AddCompare(HControlInstruction* compare); 1399 HControlInstruction* AddCompare(HControlInstruction* compare);
1385 1400
1386 Zone* zone() { return builder_->zone(); } 1401 HGraphBuilder* builder() const { return builder_; }
1387 1402
1388 HGraphBuilder* builder_; 1403 HGraphBuilder* builder_;
1389 int position_; 1404 int position_;
1390 bool finished_ : 1; 1405 bool finished_ : 1;
1391 bool deopt_then_ : 1; 1406 bool deopt_then_ : 1;
1392 bool deopt_else_ : 1; 1407 bool deopt_else_ : 1;
1393 bool did_then_ : 1; 1408 bool did_then_ : 1;
1394 bool did_else_ : 1; 1409 bool did_else_ : 1;
1395 bool did_and_ : 1; 1410 bool did_and_ : 1;
1396 bool did_or_ : 1; 1411 bool did_or_ : 1;
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 const char* failure_reason); 1953 const char* failure_reason);
1939 1954
1940 void HandleGlobalVariableAssignment(Variable* var, 1955 void HandleGlobalVariableAssignment(Variable* var,
1941 HValue* value, 1956 HValue* value,
1942 int position, 1957 int position,
1943 BailoutId ast_id); 1958 BailoutId ast_id);
1944 1959
1945 void HandlePropertyAssignment(Assignment* expr); 1960 void HandlePropertyAssignment(Assignment* expr);
1946 void HandleCompoundAssignment(Assignment* expr); 1961 void HandleCompoundAssignment(Assignment* expr);
1947 void HandlePolymorphicLoadNamedField(int position, 1962 void HandlePolymorphicLoadNamedField(int position,
1963 BailoutId ast_id,
1948 BailoutId return_id, 1964 BailoutId return_id,
1949 HValue* object, 1965 HValue* object,
1950 SmallMapList* types, 1966 SmallMapList* types,
1951 Handle<String> name); 1967 Handle<String> name);
1952 HInstruction* TryLoadPolymorphicAsMonomorphic(HValue* object, 1968
1953 SmallMapList* types, 1969 class PropertyAccessInfo {
1954 Handle<String> name); 1970 public:
1971 PropertyAccessInfo(Isolate* isolate, Handle<Map> map, Handle<String> name)
1972 : lookup_(isolate),
1973 map_(map),
1974 name_(name),
1975 access_(HObjectAccess::ForMap()) { }
1976
1977 // Checkes whether this PropertyAccessInfo can be handled as a monomorphic
1978 // load named. It additionally fills in the fields necessary to generate the
1979 // lookup code.
1980 bool CanLoadMonomorphic();
1981
1982 // Checks whether all types behave uniform when loading name. If all maps
1983 // behave the same, a single monomorphic load instruction can be emitted,
1984 // guarded by a single map-checks instruction that whether the receiver is
1985 // an instance of any of the types.
1986 // This method skips the first type in types, assuming that this
1987 // PropertyAccessInfo is built for types->first().
1988 bool CanLoadAsMonomorphic(SmallMapList* types);
1989
1990 bool IsStringLength() {
1991 return map_->instance_type() < FIRST_NONSTRING_TYPE &&
1992 name_->Equals(isolate()->heap()->length_string());
1993 }
1994
1995 bool IsArrayLength() {
1996 return map_->instance_type() == JS_ARRAY_TYPE &&
1997 name_->Equals(isolate()->heap()->length_string());
1998 }
1999
2000 bool IsTypedArrayLength() {
2001 return map_->instance_type() == JS_TYPED_ARRAY_TYPE &&
2002 name_->Equals(isolate()->heap()->length_string());
2003 }
2004
2005 bool has_holder() { return !holder_.is_null(); }
2006
2007 LookupResult* lookup() { return &lookup_; }
2008 Handle<Map> map() { return map_; }
2009 Handle<JSObject> holder() { return holder_; }
2010 Handle<JSFunction> accessor() { return accessor_; }
2011 Handle<Object> constant() { return constant_; }
2012 HObjectAccess access() { return access_; }
2013
2014 private:
2015 Isolate* isolate() { return lookup_.isolate(); }
2016
2017 bool LoadResult(Handle<Map> map);
2018 bool LookupDescriptor();
2019 bool LookupInPrototypes();
2020 bool IsCompatibleForLoad(PropertyAccessInfo* other);
2021
2022 void GeneralizeRepresentation(Representation r) {
2023 access_ = access_.WithRepresentation(
2024 access_.representation().generalize(r));
2025 }
2026
2027 LookupResult lookup_;
2028 Handle<Map> map_;
2029 Handle<String> name_;
2030 Handle<JSObject> holder_;
2031 Handle<JSFunction> accessor_;
2032 Handle<Object> constant_;
2033 HObjectAccess access_;
2034 };
2035
2036 HInstruction* BuildLoadMonomorphic(PropertyAccessInfo* info,
2037 HValue* object,
2038 HInstruction* checked_object,
2039 BailoutId ast_id,
2040 BailoutId return_id,
2041 bool can_inline_accessor = true);
2042
1955 void HandlePolymorphicStoreNamedField(int position, 2043 void HandlePolymorphicStoreNamedField(int position,
1956 BailoutId assignment_id, 2044 BailoutId assignment_id,
1957 HValue* object, 2045 HValue* object,
1958 HValue* value, 2046 HValue* value,
1959 SmallMapList* types, 2047 SmallMapList* types,
1960 Handle<String> name); 2048 Handle<String> name);
1961 bool TryStorePolymorphicAsMonomorphic(int position, 2049 bool TryStorePolymorphicAsMonomorphic(int position,
1962 BailoutId assignment_id, 2050 BailoutId assignment_id,
1963 HValue* object, 2051 HValue* object,
1964 HValue* value, 2052 HValue* value,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 bool is_store, 2111 bool is_store,
2024 bool* has_side_effects); 2112 bool* has_side_effects);
2025 2113
2026 HInstruction* BuildLoadNamedGeneric(HValue* object, 2114 HInstruction* BuildLoadNamedGeneric(HValue* object,
2027 Handle<String> name, 2115 Handle<String> name,
2028 Property* expr); 2116 Property* expr);
2029 HInstruction* BuildCallGetter(HValue* object, 2117 HInstruction* BuildCallGetter(HValue* object,
2030 Handle<Map> map, 2118 Handle<Map> map,
2031 Handle<JSFunction> getter, 2119 Handle<JSFunction> getter,
2032 Handle<JSObject> holder); 2120 Handle<JSObject> holder);
2033 HInstruction* BuildLoadNamedMonomorphic(HValue* object,
2034 Handle<String> name,
2035 Handle<Map> map);
2036 2121
2037 HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map); 2122 HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
2038 2123
2039 void BuildLoad(Property* property, 2124 void BuildLoad(Property* property,
2040 int position, 2125 int position,
2041 BailoutId ast_id); 2126 BailoutId ast_id);
2042 void PushLoad(Property* property, 2127 void PushLoad(Property* property,
2043 HValue* object, 2128 HValue* object,
2044 HValue* key, 2129 HValue* key,
2045 int position); 2130 int position);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 ElementsKind kind, 2189 ElementsKind kind,
2105 HValue* object_elements); 2190 HValue* object_elements);
2106 2191
2107 void AddCheckPrototypeMaps(Handle<JSObject> holder, 2192 void AddCheckPrototypeMaps(Handle<JSObject> holder,
2108 Handle<Map> receiver_map); 2193 Handle<Map> receiver_map);
2109 2194
2110 void AddCheckConstantFunction(Handle<JSObject> holder, 2195 void AddCheckConstantFunction(Handle<JSObject> holder,
2111 HValue* receiver, 2196 HValue* receiver,
2112 Handle<Map> receiver_map); 2197 Handle<Map> receiver_map);
2113 2198
2114 bool MatchRotateRight(HValue* left,
2115 HValue* right,
2116 HValue** operand,
2117 HValue** shift_amount);
2118
2119 // The translation state of the currently-being-translated function. 2199 // The translation state of the currently-being-translated function.
2120 FunctionState* function_state_; 2200 FunctionState* function_state_;
2121 2201
2122 // The base of the function state stack. 2202 // The base of the function state stack.
2123 FunctionState initial_function_state_; 2203 FunctionState initial_function_state_;
2124 2204
2125 // Expression context of the currently visited subexpression. NULL when 2205 // Expression context of the currently visited subexpression. NULL when
2126 // visiting statements. 2206 // visiting statements.
2127 AstContext* ast_context_; 2207 AstContext* ast_context_;
2128 2208
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 } 2380 }
2301 2381
2302 private: 2382 private:
2303 HGraphBuilder* builder_; 2383 HGraphBuilder* builder_;
2304 }; 2384 };
2305 2385
2306 2386
2307 } } // namespace v8::internal 2387 } } // namespace v8::internal
2308 2388
2309 #endif // V8_HYDROGEN_H_ 2389 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698