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

Side by Side Diff: src/hydrogen-instructions.h

Issue 6452001: Allow esi to be an allocatable register on IA32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 1169
1170 virtual void PrintDataTo(StringStream* stream) const; 1170 virtual void PrintDataTo(StringStream* stream) const;
1171 1171
1172 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") 1172 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function")
1173 1173
1174 private: 1174 private:
1175 Handle<JSFunction> function_; 1175 Handle<JSFunction> function_;
1176 }; 1176 };
1177 1177
1178 1178
1179 // TODO(3190496): This class uses hacks to get additional operands that ar
1180 // not arguments to work with the current setup. This _needs_ a cleanup.
1181 // (see HCall).
fschneider 2011/02/09 13:41:53 Maybe it would be less effort to land the refactor
1179 class HCallKeyed: public HCall { 1182 class HCallKeyed: public HCall {
1180 public: 1183 public:
1181 HCallKeyed(HValue* key, int argument_count) 1184 HCallKeyed(HValue* context, HValue* key, int argument_count)
1182 : HCall(argument_count + 1) { 1185 : HCall(argument_count + 1), context_(NULL) {
1183 SetOperandAt(0, key); 1186 SetOperandAt(0, key);
1187 SetOperandAt(argument_count + 1, context);
1184 } 1188 }
1185 1189
1186 virtual Representation RequiredInputRepresentation(int index) const { 1190 virtual Representation RequiredInputRepresentation(int index) const {
1187 return Representation::Tagged(); 1191 return Representation::Tagged();
1188 } 1192 }
1189 1193
1190 // TODO(3190496): This is a hack to get an additional operand that
1191 // is not an argument to work with the current setup. This _needs_ a cleanup.
1192 // (see HCall)
1193 virtual void PrintDataTo(StringStream* stream) const; 1194 virtual void PrintDataTo(StringStream* stream) const;
1195
1194 HValue* key() const { return OperandAt(0); } 1196 HValue* key() const { return OperandAt(0); }
1197 HValue* context() const { return context_; }
1198
1195 virtual int argument_count() const { return arguments_.length() - 1; } 1199 virtual int argument_count() const { return arguments_.length() - 1; }
1196 virtual int OperandCount() const { return arguments_.length(); } 1200 virtual int OperandCount() const { return arguments_.length() + 1; }
1197 virtual HValue* OperandAt(int index) const { return arguments_[index]; } 1201
1202 virtual HValue* OperandAt(int index) const {
1203 // The key and all the arguments are stored in the base class's
1204 // arguments_ vector. The context is in the object itself. Ugly.
1205 return (index <= argument_count()) ? arguments_[index] : context_;
1206 }
1207
1198 virtual HPushArgument* PushArgumentAt(int index) const { 1208 virtual HPushArgument* PushArgumentAt(int index) const {
1199 return HPushArgument::cast(OperandAt(index + 1)); 1209 return HPushArgument::cast(OperandAt(index + 1));
1200 } 1210 }
1201 virtual void SetArgumentAt(int index, HPushArgument* push_argument) { 1211 virtual void SetArgumentAt(int index, HPushArgument* push_argument) {
1202 HCall::SetArgumentAt(index + 1, push_argument); 1212 HCall::SetArgumentAt(index + 1, push_argument);
1203 } 1213 }
1204 1214
1205 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") 1215 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed")
1216
1217 protected:
1218 virtual void InternalSetOperandAt(int index, HValue* value);
1219
1220 private:
1221 HValue* context_;
1206 }; 1222 };
1207 1223
1208 1224
1209 class HCallNamed: public HCall { 1225 class HCallNamed: public HCall {
1210 public: 1226 public:
1211 HCallNamed(Handle<String> name, int argument_count) 1227 HCallNamed(HValue* context, Handle<String> name, int argument_count)
1212 : HCall(argument_count), name_(name) { } 1228 : HCall(argument_count), context_(NULL), name_(name) {
1229 SetOperandAt(argument_count, context);
1230 }
1231
1213 virtual void PrintDataTo(StringStream* stream) const; 1232 virtual void PrintDataTo(StringStream* stream) const;
1214 1233
1234 HValue* context() const { return context_; }
1215 Handle<String> name() const { return name_; } 1235 Handle<String> name() const { return name_; }
1216 1236
1237 virtual int OperandCount() const { return arguments_.length() + 1; }
1238
1239 virtual HValue* OperandAt(int index) const {
1240 // The arguments are in the base class's arguments_ vector. The context
1241 // is in the object itself.
1242 return (index < argument_count()) ? arguments_[index] : context_;
1243 }
1244
1217 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named") 1245 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named")
1218 1246
1247 protected:
1248 virtual void InternalSetOperandAt(int index, HValue* value);
1249
1219 private: 1250 private:
1251 HValue* context_;
1220 Handle<String> name_; 1252 Handle<String> name_;
1221 }; 1253 };
1222 1254
1223 1255
1224 class HCallFunction: public HCall { 1256 class HCallFunction: public HCall {
1225 public: 1257 public:
1226 explicit HCallFunction(int argument_count) : HCall(argument_count) { } 1258 HCallFunction(HValue* context, int argument_count)
1259 : HCall(argument_count), context_(NULL) {
1260 SetOperandAt(argument_count, context);
1261 }
1262
1263 HValue* context() const { return context_; }
1264
1265 virtual int OperandCount() const { return arguments_.length() + 1; }
1266
1267 virtual HValue* OperandAt(int index) const {
1268 // The arguments are in the base class's arguments_ vector. The context
1269 // is in the object itself.
1270 return (index < argument_count()) ? arguments_[index] : context_;
1271 }
1227 1272
1228 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function") 1273 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function")
1274
1275 protected:
1276 virtual void InternalSetOperandAt(int index, HValue* value);
1277
1278 private:
1279 HValue* context_;
1229 }; 1280 };
1230 1281
1231 1282
1232 class HCallGlobal: public HCall { 1283 class HCallGlobal: public HCall {
1233 public: 1284 public:
1234 HCallGlobal(Handle<String> name, int argument_count) 1285 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
1235 : HCall(argument_count), name_(name) { } 1286 : HCall(argument_count), context_(NULL), name_(name) {
1287 SetOperandAt(argument_count, context);
1288 }
1236 1289
1237 virtual void PrintDataTo(StringStream* stream) const; 1290 virtual void PrintDataTo(StringStream* stream) const;
1238 1291
1292 HValue* context() const { return context_; }
1239 Handle<String> name() const { return name_; } 1293 Handle<String> name() const { return name_; }
1240 1294
1295 virtual int OperandCount() const { return arguments_.length() + 1; }
1296
1297 virtual HValue* OperandAt(int index) const {
1298 // The arguments are in the base class's arguments_ vector. The context
1299 // is in the object itself.
1300 return (index < argument_count()) ? arguments_[index] : context_;
1301 }
1302
1241 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") 1303 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global")
1242 1304
1305 protected:
1306 virtual void InternalSetOperandAt(int index, HValue* value);
1307
1243 private: 1308 private:
1309 HValue* context_;
1244 Handle<String> name_; 1310 Handle<String> name_;
1245 }; 1311 };
1246 1312
1247 1313
1248 class HCallKnownGlobal: public HCall { 1314 class HCallKnownGlobal: public HCall {
1249 public: 1315 public:
1250 HCallKnownGlobal(Handle<JSFunction> target, 1316 HCallKnownGlobal(Handle<JSFunction> target,
1251 int argument_count) 1317 int argument_count)
1252 : HCall(argument_count), target_(target) { } 1318 : HCall(argument_count), target_(target) { }
1253 1319
1254 Handle<JSFunction> target() const { return target_; } 1320 Handle<JSFunction> target() const { return target_; }
1255 1321
1256 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") 1322 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global")
1257 1323
1258 private: 1324 private:
1259 Handle<JSFunction> target_; 1325 Handle<JSFunction> target_;
1260 }; 1326 };
1261 1327
1262 1328
1263 class HCallNew: public HCall { 1329 class HCallNew: public HCall {
1264 public: 1330 public:
1265 explicit HCallNew(int argument_count) : HCall(argument_count) { } 1331 HCallNew(HValue* context, int argument_count)
1332 : HCall(argument_count), context_(NULL) {
1333 SetOperandAt(argument_count, context);
1334 }
1266 1335
1267 virtual Representation RequiredInputRepresentation(int index) const { 1336 virtual Representation RequiredInputRepresentation(int index) const {
1268 return Representation::Tagged(); 1337 return Representation::Tagged();
1269 } 1338 }
1270 1339
1340 HValue* context() const { return context_; }
1271 HValue* constructor() const { return ArgumentAt(0); } 1341 HValue* constructor() const { return ArgumentAt(0); }
1272 1342
1343 virtual int OperandCount() const { return arguments_.length() + 1; }
1344
1345 virtual HValue* OperandAt(int index) const {
1346 // The arguments are in the base class's arguments_ vector. The context
1347 // is in the object itself.
1348 return (index < argument_count()) ? arguments_[index] : context_;
1349 }
1350
1273 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") 1351 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new")
1352
1353 protected:
1354 virtual void InternalSetOperandAt(int index, HValue* value);
1355
1356 private:
1357 HValue* context_;
1274 }; 1358 };
1275 1359
1276 1360
1277 class HCallRuntime: public HCall { 1361 class HCallRuntime: public HCall {
1278 public: 1362 public:
1279 HCallRuntime(Handle<String> name, 1363 HCallRuntime(Handle<String> name,
1280 Runtime::Function* c_function, 1364 Runtime::Function* c_function,
1281 int argument_count) 1365 int argument_count)
1282 : HCall(argument_count), c_function_(c_function), name_(name) { } 1366 : HCall(argument_count), c_function_(c_function), name_(name) { }
1283 virtual void PrintDataTo(StringStream* stream) const; 1367 virtual void PrintDataTo(StringStream* stream) const;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1854 virtual int OperandCount() const { return operands_.length(); } 1938 virtual int OperandCount() const { return operands_.length(); }
1855 virtual HValue* OperandAt(int index) const { return operands_[index]; } 1939 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1856 1940
1857 DECLARE_INSTRUCTION(BinaryOperation) 1941 DECLARE_INSTRUCTION(BinaryOperation)
1858 1942
1859 protected: 1943 protected:
1860 virtual void InternalSetOperandAt(int index, HValue* value) { 1944 virtual void InternalSetOperandAt(int index, HValue* value) {
1861 operands_[index] = value; 1945 operands_[index] = value;
1862 } 1946 }
1863 1947
1864 private:
1865 HOperandVector<2> operands_; 1948 HOperandVector<2> operands_;
1866 }; 1949 };
1867 1950
1868 1951
1869 class HApplyArguments: public HInstruction { 1952 class HApplyArguments: public HInstruction {
1870 public: 1953 public:
1871 HApplyArguments(HValue* function, 1954 HApplyArguments(HValue* function,
1872 HValue* receiver, 1955 HValue* receiver,
1873 HValue* length, 1956 HValue* length,
1874 HValue* elements) { 1957 HValue* elements) {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 virtual bool DataEquals(HValue* other) const { 2354 virtual bool DataEquals(HValue* other) const {
2272 HTypeofIs* b = HTypeofIs::cast(other); 2355 HTypeofIs* b = HTypeofIs::cast(other);
2273 return type_literal_.is_identical_to(b->type_literal_); 2356 return type_literal_.is_identical_to(b->type_literal_);
2274 } 2357 }
2275 2358
2276 private: 2359 private:
2277 Handle<String> type_literal_; 2360 Handle<String> type_literal_;
2278 }; 2361 };
2279 2362
2280 2363
2281 class HInstanceOf: public HBinaryOperation { 2364 class HInstanceOf: public HInstruction {
2282 public: 2365 public:
2283 HInstanceOf(HValue* left, HValue* right) : HBinaryOperation(left, right) { 2366 HInstanceOf(HValue* context, HValue* left, HValue* right) {
2367 SetOperandAt(0, context);
2368 SetOperandAt(1, left);
2369 SetOperandAt(2, right);
2284 set_representation(Representation::Tagged()); 2370 set_representation(Representation::Tagged());
2285 SetAllSideEffects(); 2371 SetAllSideEffects();
2286 } 2372 }
2287 2373
2374 HValue* context() const { return operands_[0]; }
2375 HValue* left() const { return operands_[1]; }
2376 HValue* right() const { return operands_[2]; }
2377
2288 virtual bool EmitAtUses() const { return uses()->length() <= 1; } 2378 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2289 2379
2290 virtual Representation RequiredInputRepresentation(int index) const { 2380 virtual Representation RequiredInputRepresentation(int index) const {
2291 return Representation::Tagged(); 2381 return Representation::Tagged();
2292 } 2382 }
2293 2383
2384 virtual void PrintDataTo(StringStream* stream) const;
2385
2386 virtual int OperandCount() const { return 3; }
2387 virtual HValue* OperandAt(int index) const { return operands_[index]; }
2388
2294 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") 2389 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of")
2390
2391 protected:
2392 virtual void InternalSetOperandAt(int index, HValue* value) {
2393 operands_[index] = value;
2394 }
2395
2396 private:
2397 HOperandVector<3> operands_;
2295 }; 2398 };
2296 2399
2297 2400
2298 class HInstanceOfKnownGlobal: public HUnaryOperation { 2401 class HInstanceOfKnownGlobal: public HUnaryOperation {
2299 public: 2402 public:
2300 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right) 2403 HInstanceOfKnownGlobal(HValue* left, Handle<JSFunction> right)
2301 : HUnaryOperation(left), function_(right) { 2404 : HUnaryOperation(left), function_(right) {
2302 set_representation(Representation::Tagged()); 2405 set_representation(Representation::Tagged());
2303 SetAllSideEffects(); 2406 SetAllSideEffects();
2304 } 2407 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 2656
2554 virtual void PrintDataTo(StringStream* stream) const; 2657 virtual void PrintDataTo(StringStream* stream) const;
2555 2658
2556 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") 2659 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
2557 2660
2558 private: 2661 private:
2559 unsigned index_; 2662 unsigned index_;
2560 }; 2663 };
2561 2664
2562 2665
2563 class HCallStub: public HInstruction { 2666 class HCallStub: public HUnaryOperation {
2564 public: 2667 public:
2565 HCallStub(CodeStub::Major major_key, int argument_count) 2668 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
2566 : major_key_(major_key), 2669 : HUnaryOperation(context),
2670 major_key_(major_key),
2567 argument_count_(argument_count), 2671 argument_count_(argument_count),
2568 transcendental_type_(TranscendentalCache::kNumberOfCaches) { 2672 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
2569 set_representation(Representation::Tagged()); 2673 set_representation(Representation::Tagged());
2570 SetAllSideEffects(); 2674 SetAllSideEffects();
2571 } 2675 }
2572 2676
2573 CodeStub::Major major_key() { return major_key_; } 2677 CodeStub::Major major_key() { return major_key_; }
2574 int argument_count() { return argument_count_; } 2678 int argument_count() { return argument_count_; }
2679 HValue* context() { return OperandAt(0); }
2575 2680
2576 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 2681 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
2577 transcendental_type_ = transcendental_type; 2682 transcendental_type_ = transcendental_type;
2578 } 2683 }
2579 TranscendentalCache::Type transcendental_type() { 2684 TranscendentalCache::Type transcendental_type() {
2580 return transcendental_type_; 2685 return transcendental_type_;
2581 } 2686 }
2582 virtual void PrintDataTo(StringStream* stream) const; 2687 virtual void PrintDataTo(StringStream* stream) const;
2583 2688
2584 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") 2689 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub")
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 HLoadNamedField* b = HLoadNamedField::cast(other); 2861 HLoadNamedField* b = HLoadNamedField::cast(other);
2757 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; 2862 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_;
2758 } 2863 }
2759 2864
2760 private: 2865 private:
2761 bool is_in_object_; 2866 bool is_in_object_;
2762 int offset_; 2867 int offset_;
2763 }; 2868 };
2764 2869
2765 2870
2766 class HLoadNamedGeneric: public HUnaryOperation { 2871 class HLoadNamedGeneric: public HBinaryOperation {
2767 public: 2872 public:
2768 HLoadNamedGeneric(HValue* object, Handle<Object> name) 2873 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
2769 : HUnaryOperation(object), name_(name) { 2874 : HBinaryOperation(context, object), name_(name) {
2770 set_representation(Representation::Tagged()); 2875 set_representation(Representation::Tagged());
2771 SetAllSideEffects(); 2876 SetAllSideEffects();
2772 } 2877 }
2773 2878
2774 HValue* object() const { return OperandAt(0); } 2879 HValue* context() const { return OperandAt(0); }
2880 HValue* object() const { return OperandAt(1); }
2775 Handle<Object> name() const { return name_; } 2881 Handle<Object> name() const { return name_; }
2776 2882
2777 virtual Representation RequiredInputRepresentation(int index) const { 2883 virtual Representation RequiredInputRepresentation(int index) const {
2778 return Representation::Tagged(); 2884 return Representation::Tagged();
2779 } 2885 }
2780 2886
2781 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic") 2887 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric, "load_named_generic")
2782 2888
2783 private: 2889 private:
2784 Handle<Object> name_; 2890 Handle<Object> name_;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2947 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2842 "load_keyed_fast_element") 2948 "load_keyed_fast_element")
2843 2949
2844 protected: 2950 protected:
2845 virtual bool DataEquals(HValue* other) const { return true; } 2951 virtual bool DataEquals(HValue* other) const { return true; }
2846 }; 2952 };
2847 2953
2848 2954
2849 class HLoadKeyedGeneric: public HLoadKeyed { 2955 class HLoadKeyedGeneric: public HLoadKeyed {
2850 public: 2956 public:
2851 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2957 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key)
2958 : HLoadKeyed(obj, key), context_(NULL) {
2959 SetOperandAt(2, context);
2852 SetAllSideEffects(); 2960 SetAllSideEffects();
2853 } 2961 }
2854 2962
2963 HValue* context() const { return context_; }
2964 HValue* object() const { return operands_[0]; }
2965 HValue* key() const { return operands_[1]; }
2966
2967 virtual int OperandCount() const { return 3; }
2968 virtual HValue* OperandAt(int index) const {
2969 return (index < 2) ? operands_[index] : context_;
2970 }
2971
2855 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2972 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
2973
2974 protected:
2975 virtual void InternalSetOperandAt(int index, HValue* value);
2976
2977 private:
2978 HValue* context_;
2856 }; 2979 };
2857 2980
2858 2981
2859 class HStoreNamed: public HBinaryOperation { 2982 class HStoreNamed: public HBinaryOperation {
2860 public: 2983 public:
2861 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) 2984 HStoreNamed(HValue* obj, Handle<String> name, HValue* val)
2862 : HBinaryOperation(obj, val), name_(name) { 2985 : HBinaryOperation(obj, val), name_(name) {
2863 } 2986 }
2864 2987
2865 virtual Representation RequiredInputRepresentation(int index) const { 2988 virtual Representation RequiredInputRepresentation(int index) const {
2866 return Representation::Tagged(); 2989 return Representation::Tagged();
2867 } 2990 }
2868 2991
2869 virtual void PrintDataTo(StringStream* stream) const; 2992 virtual void PrintDataTo(StringStream* stream) const;
2870 2993
2871 HValue* object() const { return OperandAt(0); } 2994 HValue* object() const { return OperandAt(0); }
2872 Handle<Object> name() const { return name_; } 2995 Handle<String> name() const { return name_; }
2873 HValue* value() const { return OperandAt(1); } 2996 HValue* value() const { return OperandAt(1); }
2874 void set_value(HValue* value) { SetOperandAt(1, value); } 2997 void set_value(HValue* value) { SetOperandAt(1, value); }
2875 2998
2876 DECLARE_INSTRUCTION(StoreNamed) 2999 DECLARE_INSTRUCTION(StoreNamed)
2877 3000
2878 private: 3001 private:
2879 Handle<Object> name_; 3002 Handle<String> name_;
2880 }; 3003 };
2881 3004
2882 3005
2883 class HStoreNamedField: public HStoreNamed { 3006 class HStoreNamedField: public HStoreNamed {
2884 public: 3007 public:
2885 HStoreNamedField(HValue* obj, 3008 HStoreNamedField(HValue* obj,
2886 Handle<Object> name, 3009 Handle<String> name,
2887 HValue* val, 3010 HValue* val,
2888 bool in_object, 3011 bool in_object,
2889 int offset) 3012 int offset)
2890 : HStoreNamed(obj, name, val), 3013 : HStoreNamed(obj, name, val),
2891 is_in_object_(in_object), 3014 is_in_object_(in_object),
2892 offset_(offset) { 3015 offset_(offset) {
2893 if (is_in_object_) { 3016 if (is_in_object_) {
2894 SetFlag(kChangesInobjectFields); 3017 SetFlag(kChangesInobjectFields);
2895 } else { 3018 } else {
2896 SetFlag(kChangesBackingStoreFields); 3019 SetFlag(kChangesBackingStoreFields);
(...skipping 18 matching lines...) Expand all
2915 3038
2916 private: 3039 private:
2917 bool is_in_object_; 3040 bool is_in_object_;
2918 int offset_; 3041 int offset_;
2919 Handle<Map> transition_; 3042 Handle<Map> transition_;
2920 }; 3043 };
2921 3044
2922 3045
2923 class HStoreNamedGeneric: public HStoreNamed { 3046 class HStoreNamedGeneric: public HStoreNamed {
2924 public: 3047 public:
2925 HStoreNamedGeneric(HValue* obj, Handle<Object> name, HValue* val) 3048 HStoreNamedGeneric(HValue* context,
2926 : HStoreNamed(obj, name, val) { 3049 HValue* object,
3050 Handle<String> name,
3051 HValue* value)
3052 : HStoreNamed(object, name, value), context_(NULL) {
3053 SetOperandAt(2, context);
2927 SetAllSideEffects(); 3054 SetAllSideEffects();
2928 } 3055 }
2929 3056
3057 HValue* context() const { return context_; }
3058 HValue* object() const { return operands_[0]; }
3059 HValue* value() const { return operands_[1]; }
3060
3061 virtual int OperandCount() const { return 3; }
3062
3063 virtual HValue* OperandAt(int index) const {
3064 return (index < 2) ? operands_[index] : context_;
3065 }
3066
2930 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic") 3067 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric, "store_named_generic")
3068
3069 protected:
3070 virtual void InternalSetOperandAt(int index, HValue* value);
3071
3072 private:
3073 HValue* context_;
2931 }; 3074 };
2932 3075
2933 3076
2934 class HStoreKeyed: public HInstruction { 3077 class HStoreKeyed: public HInstruction {
2935 public: 3078 public:
2936 HStoreKeyed(HValue* obj, HValue* key, HValue* val) { 3079 HStoreKeyed(HValue* obj, HValue* key, HValue* val) {
2937 SetOperandAt(0, obj); 3080 SetOperandAt(0, obj);
2938 SetOperandAt(1, key); 3081 SetOperandAt(1, key);
2939 SetOperandAt(2, val); 3082 SetOperandAt(2, val);
2940 } 3083 }
(...skipping 14 matching lines...) Expand all
2955 return StoringValueNeedsWriteBarrier(value()); 3098 return StoringValueNeedsWriteBarrier(value());
2956 } 3099 }
2957 3100
2958 DECLARE_INSTRUCTION(StoreKeyed) 3101 DECLARE_INSTRUCTION(StoreKeyed)
2959 3102
2960 protected: 3103 protected:
2961 virtual void InternalSetOperandAt(int index, HValue* value) { 3104 virtual void InternalSetOperandAt(int index, HValue* value) {
2962 operands_[index] = value; 3105 operands_[index] = value;
2963 } 3106 }
2964 3107
2965 private:
2966 HOperandVector<3> operands_; 3108 HOperandVector<3> operands_;
2967 }; 3109 };
2968 3110
2969 3111
2970 class HStoreKeyedFastElement: public HStoreKeyed { 3112 class HStoreKeyedFastElement: public HStoreKeyed {
2971 public: 3113 public:
2972 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val) 3114 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val)
2973 : HStoreKeyed(obj, key, val) { 3115 : HStoreKeyed(obj, key, val) {
2974 SetFlag(kChangesArrayElements); 3116 SetFlag(kChangesArrayElements);
2975 } 3117 }
2976 3118
2977 virtual Representation RequiredInputRepresentation(int index) const { 3119 virtual Representation RequiredInputRepresentation(int index) const {
2978 // The key is supposed to be Integer32. 3120 // The key is supposed to be Integer32.
2979 return (index == 1) ? Representation::Integer32() 3121 return (index == 1) ? Representation::Integer32()
2980 : Representation::Tagged(); 3122 : Representation::Tagged();
2981 } 3123 }
2982 3124
2983 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement, 3125 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement,
2984 "store_keyed_fast_element") 3126 "store_keyed_fast_element")
2985 }; 3127 };
2986 3128
2987 3129
2988 class HStoreKeyedGeneric: public HStoreKeyed { 3130 class HStoreKeyedGeneric: public HStoreKeyed {
2989 public: 3131 public:
2990 HStoreKeyedGeneric(HValue* obj, HValue* key, HValue* val) 3132 HStoreKeyedGeneric(HValue* context,
2991 : HStoreKeyed(obj, key, val) { 3133 HValue* object,
3134 HValue* key,
3135 HValue* value)
3136 : HStoreKeyed(object, key, value), context_(NULL) {
3137 SetOperandAt(3, context);
2992 SetAllSideEffects(); 3138 SetAllSideEffects();
2993 } 3139 }
2994 3140
3141 HValue* context() const { return context_; }
3142 HValue* object() const { return operands_[0]; }
3143 HValue* key() const { return operands_[1]; }
3144 HValue* value() const { return operands_[2]; }
3145
3146 virtual int OperandCount() const { return 4; }
3147
3148 virtual HValue* OperandAt(int index) const {
3149 return (index < 3) ? operands_[index] : context_;
3150 }
3151
2995 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic") 3152 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric, "store_keyed_generic")
3153
3154 protected:
3155 virtual void InternalSetOperandAt(int index, HValue* value);
3156
3157 private:
3158 HValue* context_;
2996 }; 3159 };
2997 3160
2998 3161
2999 class HStringCharCodeAt: public HBinaryOperation { 3162 class HStringCharCodeAt: public HBinaryOperation {
3000 public: 3163 public:
3001 HStringCharCodeAt(HValue* string, HValue* index) 3164 HStringCharCodeAt(HValue* string, HValue* index)
3002 : HBinaryOperation(string, index) { 3165 : HBinaryOperation(string, index) {
3003 set_representation(Representation::Integer32()); 3166 set_representation(Representation::Integer32());
3004 SetFlag(kUseGVN); 3167 SetFlag(kUseGVN);
3005 } 3168 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
3087 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal") 3250 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal")
3088 3251
3089 private: 3252 private:
3090 int length_; 3253 int length_;
3091 Handle<FixedArray> constant_elements_; 3254 Handle<FixedArray> constant_elements_;
3092 }; 3255 };
3093 3256
3094 3257
3095 class HObjectLiteral: public HMaterializedLiteral { 3258 class HObjectLiteral: public HMaterializedLiteral {
3096 public: 3259 public:
3097 HObjectLiteral(Handle<FixedArray> constant_properties, 3260 HObjectLiteral(HValue* context,
3261 Handle<FixedArray> constant_properties,
3098 bool fast_elements, 3262 bool fast_elements,
3099 int literal_index, 3263 int literal_index,
3100 int depth) 3264 int depth)
3101 : HMaterializedLiteral(literal_index, depth), 3265 : HMaterializedLiteral(literal_index, depth),
3266 context_(NULL),
3102 constant_properties_(constant_properties), 3267 constant_properties_(constant_properties),
3103 fast_elements_(fast_elements) {} 3268 fast_elements_(fast_elements) {
3269 SetOperandAt(0, context);
3270 }
3104 3271
3272 HValue* context() const { return context_; }
3105 Handle<FixedArray> constant_properties() const { 3273 Handle<FixedArray> constant_properties() const {
3106 return constant_properties_; 3274 return constant_properties_;
3107 } 3275 }
3108 bool fast_elements() const { return fast_elements_; } 3276 bool fast_elements() const { return fast_elements_; }
3109 3277
3278 virtual int OperandCount() const { return 1; }
3279 virtual HValue* OperandAt(int index) const { return context_; }
3280
3110 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal") 3281 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal")
3111 3282
3283 protected:
3284 virtual void InternalSetOperandAt(int index, HValue* value) {
3285 context_ = value;
3286 }
3287
3112 private: 3288 private:
3289 HValue* context_;
3113 Handle<FixedArray> constant_properties_; 3290 Handle<FixedArray> constant_properties_;
3114 bool fast_elements_; 3291 bool fast_elements_;
3115 }; 3292 };
3116 3293
3117 3294
3118 class HRegExpLiteral: public HMaterializedLiteral { 3295 class HRegExpLiteral: public HMaterializedLiteral {
3119 public: 3296 public:
3120 HRegExpLiteral(Handle<String> pattern, 3297 HRegExpLiteral(Handle<String> pattern,
3121 Handle<String> flags, 3298 Handle<String> flags,
3122 int literal_index) 3299 int literal_index)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 HValue* object() const { return left(); } 3371 HValue* object() const { return left(); }
3195 HValue* key() const { return right(); } 3372 HValue* key() const { return right(); }
3196 }; 3373 };
3197 3374
3198 #undef DECLARE_INSTRUCTION 3375 #undef DECLARE_INSTRUCTION
3199 #undef DECLARE_CONCRETE_INSTRUCTION 3376 #undef DECLARE_CONCRETE_INSTRUCTION
3200 3377
3201 } } // namespace v8::internal 3378 } } // namespace v8::internal
3202 3379
3203 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3380 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698