| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 extra_expression_stack_count_(0), | 257 extra_expression_stack_count_(0), |
| 258 register_params_(NULL) { } | 258 register_params_(NULL) { } |
| 259 int register_param_count_; | 259 int register_param_count_; |
| 260 const Register* stack_parameter_count_; | 260 const Register* stack_parameter_count_; |
| 261 int extra_expression_stack_count_; | 261 int extra_expression_stack_count_; |
| 262 Register* register_params_; | 262 Register* register_params_; |
| 263 Address deoptimization_handler_; | 263 Address deoptimization_handler_; |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 | 266 |
| 267 class HGraph; | |
| 268 struct Register; | |
| 269 class HydrogenCodeStub : public CodeStub { | 267 class HydrogenCodeStub : public CodeStub { |
| 270 public: | 268 public: |
| 271 // Retrieve the code for the stub. Generate the code if needed. | 269 // Retrieve the code for the stub. Generate the code if needed. |
| 272 virtual Handle<Code> GenerateCode() = 0; | 270 virtual Handle<Code> GenerateCode() = 0; |
| 273 | 271 |
| 274 virtual int GetCodeKind() { return Code::COMPILED_STUB; } | 272 virtual int GetCodeKind() { return Code::COMPILED_STUB; } |
| 275 | 273 |
| 276 CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) { | 274 CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) { |
| 277 return isolate->code_stub_interface_descriptor(MajorKey()); | 275 return isolate->code_stub_interface_descriptor(MajorKey()); |
| 278 } | 276 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 STATIC_ASSERT(kMaximumClonedLength < 16); | 466 STATIC_ASSERT(kMaximumClonedLength < 16); |
| 469 Major MajorKey() { return FastCloneShallowArray; } | 467 Major MajorKey() { return FastCloneShallowArray; } |
| 470 int MinorKey() { | 468 int MinorKey() { |
| 471 return AllocationSiteModeBits::encode(allocation_site_mode_) | 469 return AllocationSiteModeBits::encode(allocation_site_mode_) |
| 472 | ModeBits::encode(mode_) | 470 | ModeBits::encode(mode_) |
| 473 | LengthBits::encode(length_); | 471 | LengthBits::encode(length_); |
| 474 } | 472 } |
| 475 }; | 473 }; |
| 476 | 474 |
| 477 | 475 |
| 478 class FastCloneShallowObjectStub : public PlatformCodeStub { | 476 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
| 479 public: | 477 public: |
| 480 // Maximum number of properties in copied object. | 478 // Maximum number of properties in copied object. |
| 481 static const int kMaximumClonedProperties = 6; | 479 static const int kMaximumClonedProperties = 6; |
| 482 | 480 |
| 483 explicit FastCloneShallowObjectStub(int length) : length_(length) { | 481 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
| 484 ASSERT_GE(length_, 0); | 482 ASSERT_GE(length_, 0); |
| 485 ASSERT_LE(length_, kMaximumClonedProperties); | 483 ASSERT_LE(length_, kMaximumClonedProperties); |
| 486 } | 484 } |
| 487 | 485 |
| 488 void Generate(MacroAssembler* masm); | 486 int length() const { return length_; } |
| 487 |
| 488 virtual Handle<Code> GenerateCode(); |
| 489 |
| 490 virtual void InitializeInterfaceDescriptor( |
| 491 Isolate* isolate, |
| 492 CodeStubInterfaceDescriptor* descriptor); |
| 489 | 493 |
| 490 private: | 494 private: |
| 491 int length_; | 495 int length_; |
| 492 | 496 |
| 493 Major MajorKey() { return FastCloneShallowObject; } | 497 Major MajorKey() { return FastCloneShallowObject; } |
| 494 int MinorKey() { return length_; } | 498 int MinorKey() { return length_; } |
| 499 |
| 500 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 495 }; | 501 }; |
| 496 | 502 |
| 497 | 503 |
| 498 class InstanceofStub: public PlatformCodeStub { | 504 class InstanceofStub: public PlatformCodeStub { |
| 499 public: | 505 public: |
| 500 enum Flags { | 506 enum Flags { |
| 501 kNoFlags = 0, | 507 kNoFlags = 0, |
| 502 kArgsInRegisters = 1 << 0, | 508 kArgsInRegisters = 1 << 0, |
| 503 kCallSiteInlineCheck = 1 << 1, | 509 kCallSiteInlineCheck = 1 << 1, |
| 504 kReturnTrueFalseObject = 1 << 2 | 510 kReturnTrueFalseObject = 1 << 2 |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 }; | 1196 }; |
| 1191 | 1197 |
| 1192 | 1198 |
| 1193 class KeyedLoadFastElementStub : public HydrogenCodeStub { | 1199 class KeyedLoadFastElementStub : public HydrogenCodeStub { |
| 1194 public: | 1200 public: |
| 1195 KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) { | 1201 KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) { |
| 1196 bit_field_ = ElementsKindBits::encode(elements_kind) | | 1202 bit_field_ = ElementsKindBits::encode(elements_kind) | |
| 1197 IsJSArrayBits::encode(is_js_array); | 1203 IsJSArrayBits::encode(is_js_array); |
| 1198 } | 1204 } |
| 1199 | 1205 |
| 1200 Major MajorKey() { return KeyedLoadElement; } | |
| 1201 int MinorKey() { return bit_field_; } | |
| 1202 | |
| 1203 bool is_js_array() const { | 1206 bool is_js_array() const { |
| 1204 return IsJSArrayBits::decode(bit_field_); | 1207 return IsJSArrayBits::decode(bit_field_); |
| 1205 } | 1208 } |
| 1206 | 1209 |
| 1207 ElementsKind elements_kind() const { | 1210 ElementsKind elements_kind() const { |
| 1208 return ElementsKindBits::decode(bit_field_); | 1211 return ElementsKindBits::decode(bit_field_); |
| 1209 } | 1212 } |
| 1210 | 1213 |
| 1211 virtual Handle<Code> GenerateCode(); | 1214 virtual Handle<Code> GenerateCode(); |
| 1212 | 1215 |
| 1213 virtual void InitializeInterfaceDescriptor( | 1216 virtual void InitializeInterfaceDescriptor( |
| 1214 Isolate* isolate, | 1217 Isolate* isolate, |
| 1215 CodeStubInterfaceDescriptor* descriptor); | 1218 CodeStubInterfaceDescriptor* descriptor); |
| 1216 | 1219 |
| 1217 private: | 1220 private: |
| 1218 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 1221 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 1219 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1222 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1220 uint32_t bit_field_; | 1223 uint32_t bit_field_; |
| 1221 | 1224 |
| 1225 Major MajorKey() { return KeyedLoadElement; } |
| 1226 int MinorKey() { return bit_field_; } |
| 1227 |
| 1222 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); | 1228 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
| 1223 }; | 1229 }; |
| 1224 | 1230 |
| 1225 | 1231 |
| 1226 class TransitionElementsKindStub : public HydrogenCodeStub { | 1232 class TransitionElementsKindStub : public HydrogenCodeStub { |
| 1227 public: | 1233 public: |
| 1228 TransitionElementsKindStub(ElementsKind from_kind, | 1234 TransitionElementsKindStub(ElementsKind from_kind, |
| 1229 ElementsKind to_kind) { | 1235 ElementsKind to_kind) { |
| 1230 bit_field_ = FromKindBits::encode(from_kind) | | 1236 bit_field_ = FromKindBits::encode(from_kind) | |
| 1231 ToKindBits::encode(to_kind); | 1237 ToKindBits::encode(to_kind); |
| 1232 } | 1238 } |
| 1233 | 1239 |
| 1234 Major MajorKey() { return TransitionElementsKind; } | |
| 1235 int MinorKey() { return bit_field_; } | |
| 1236 | |
| 1237 ElementsKind from_kind() const { | 1240 ElementsKind from_kind() const { |
| 1238 return FromKindBits::decode(bit_field_); | 1241 return FromKindBits::decode(bit_field_); |
| 1239 } | 1242 } |
| 1240 | 1243 |
| 1241 ElementsKind to_kind() const { | 1244 ElementsKind to_kind() const { |
| 1242 return ToKindBits::decode(bit_field_); | 1245 return ToKindBits::decode(bit_field_); |
| 1243 } | 1246 } |
| 1244 | 1247 |
| 1245 virtual Handle<Code> GenerateCode(); | 1248 virtual Handle<Code> GenerateCode(); |
| 1246 | 1249 |
| 1247 virtual void InitializeInterfaceDescriptor( | 1250 virtual void InitializeInterfaceDescriptor( |
| 1248 Isolate* isolate, | 1251 Isolate* isolate, |
| 1249 CodeStubInterfaceDescriptor* descriptor); | 1252 CodeStubInterfaceDescriptor* descriptor); |
| 1250 | 1253 |
| 1251 private: | 1254 private: |
| 1252 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 1255 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
| 1253 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 1256 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1254 uint32_t bit_field_; | 1257 uint32_t bit_field_; |
| 1255 | 1258 |
| 1259 Major MajorKey() { return TransitionElementsKind; } |
| 1260 int MinorKey() { return bit_field_; } |
| 1261 |
| 1256 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1262 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 1257 }; | 1263 }; |
| 1258 | 1264 |
| 1259 | 1265 |
| 1260 class KeyedStoreElementStub : public PlatformCodeStub { | 1266 class KeyedStoreElementStub : public PlatformCodeStub { |
| 1261 public: | 1267 public: |
| 1262 KeyedStoreElementStub(bool is_js_array, | 1268 KeyedStoreElementStub(bool is_js_array, |
| 1263 ElementsKind elements_kind, | 1269 ElementsKind elements_kind, |
| 1264 KeyedAccessGrowMode grow_mode) | 1270 KeyedAccessGrowMode grow_mode) |
| 1265 : is_js_array_(is_js_array), | 1271 : is_js_array_(is_js_array), |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 | 1479 |
| 1474 // The current function entry hook. | 1480 // The current function entry hook. |
| 1475 static FunctionEntryHook entry_hook_; | 1481 static FunctionEntryHook entry_hook_; |
| 1476 | 1482 |
| 1477 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1483 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1478 }; | 1484 }; |
| 1479 | 1485 |
| 1480 } } // namespace v8::internal | 1486 } } // namespace v8::internal |
| 1481 | 1487 |
| 1482 #endif // V8_CODE_STUBS_H_ | 1488 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |