| 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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1215 }; | 1221 }; |
| 1216 | 1222 |
| 1217 | 1223 |
| 1218 class KeyedLoadFastElementStub : public HydrogenCodeStub { | 1224 class KeyedLoadFastElementStub : public HydrogenCodeStub { |
| 1219 public: | 1225 public: |
| 1220 KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) { | 1226 KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) { |
| 1221 bit_field_ = ElementsKindBits::encode(elements_kind) | | 1227 bit_field_ = ElementsKindBits::encode(elements_kind) | |
| 1222 IsJSArrayBits::encode(is_js_array); | 1228 IsJSArrayBits::encode(is_js_array); |
| 1223 } | 1229 } |
| 1224 | 1230 |
| 1225 Major MajorKey() { return KeyedLoadElement; } | |
| 1226 int MinorKey() { return bit_field_; } | |
| 1227 | |
| 1228 bool is_js_array() const { | 1231 bool is_js_array() const { |
| 1229 return IsJSArrayBits::decode(bit_field_); | 1232 return IsJSArrayBits::decode(bit_field_); |
| 1230 } | 1233 } |
| 1231 | 1234 |
| 1232 ElementsKind elements_kind() const { | 1235 ElementsKind elements_kind() const { |
| 1233 return ElementsKindBits::decode(bit_field_); | 1236 return ElementsKindBits::decode(bit_field_); |
| 1234 } | 1237 } |
| 1235 | 1238 |
| 1236 virtual Handle<Code> GenerateCode(); | 1239 virtual Handle<Code> GenerateCode(); |
| 1237 | 1240 |
| 1238 virtual void InitializeInterfaceDescriptor( | 1241 virtual void InitializeInterfaceDescriptor( |
| 1239 Isolate* isolate, | 1242 Isolate* isolate, |
| 1240 CodeStubInterfaceDescriptor* descriptor); | 1243 CodeStubInterfaceDescriptor* descriptor); |
| 1241 | 1244 |
| 1242 private: | 1245 private: |
| 1243 class IsJSArrayBits: public BitField<bool, 8, 1> {}; | 1246 class IsJSArrayBits: public BitField<bool, 8, 1> {}; |
| 1244 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1247 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1245 uint32_t bit_field_; | 1248 uint32_t bit_field_; |
| 1246 | 1249 |
| 1250 Major MajorKey() { return KeyedLoadElement; } |
| 1251 int MinorKey() { return bit_field_; } |
| 1252 |
| 1247 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); | 1253 DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub); |
| 1248 }; | 1254 }; |
| 1249 | 1255 |
| 1250 | 1256 |
| 1251 class TransitionElementsKindStub : public HydrogenCodeStub { | 1257 class TransitionElementsKindStub : public HydrogenCodeStub { |
| 1252 public: | 1258 public: |
| 1253 TransitionElementsKindStub(ElementsKind from_kind, | 1259 TransitionElementsKindStub(ElementsKind from_kind, |
| 1254 ElementsKind to_kind) { | 1260 ElementsKind to_kind) { |
| 1255 bit_field_ = FromKindBits::encode(from_kind) | | 1261 bit_field_ = FromKindBits::encode(from_kind) | |
| 1256 ToKindBits::encode(to_kind); | 1262 ToKindBits::encode(to_kind); |
| 1257 } | 1263 } |
| 1258 | 1264 |
| 1259 Major MajorKey() { return TransitionElementsKind; } | |
| 1260 int MinorKey() { return bit_field_; } | |
| 1261 | |
| 1262 ElementsKind from_kind() const { | 1265 ElementsKind from_kind() const { |
| 1263 return FromKindBits::decode(bit_field_); | 1266 return FromKindBits::decode(bit_field_); |
| 1264 } | 1267 } |
| 1265 | 1268 |
| 1266 ElementsKind to_kind() const { | 1269 ElementsKind to_kind() const { |
| 1267 return ToKindBits::decode(bit_field_); | 1270 return ToKindBits::decode(bit_field_); |
| 1268 } | 1271 } |
| 1269 | 1272 |
| 1270 virtual Handle<Code> GenerateCode(); | 1273 virtual Handle<Code> GenerateCode(); |
| 1271 | 1274 |
| 1272 virtual void InitializeInterfaceDescriptor( | 1275 virtual void InitializeInterfaceDescriptor( |
| 1273 Isolate* isolate, | 1276 Isolate* isolate, |
| 1274 CodeStubInterfaceDescriptor* descriptor); | 1277 CodeStubInterfaceDescriptor* descriptor); |
| 1275 | 1278 |
| 1276 private: | 1279 private: |
| 1277 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; | 1280 class FromKindBits: public BitField<ElementsKind, 8, 8> {}; |
| 1278 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 1281 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1279 uint32_t bit_field_; | 1282 uint32_t bit_field_; |
| 1280 | 1283 |
| 1284 Major MajorKey() { return TransitionElementsKind; } |
| 1285 int MinorKey() { return bit_field_; } |
| 1286 |
| 1281 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1287 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 1282 }; | 1288 }; |
| 1283 | 1289 |
| 1284 | 1290 |
| 1285 class KeyedStoreElementStub : public PlatformCodeStub { | 1291 class KeyedStoreElementStub : public PlatformCodeStub { |
| 1286 public: | 1292 public: |
| 1287 KeyedStoreElementStub(bool is_js_array, | 1293 KeyedStoreElementStub(bool is_js_array, |
| 1288 ElementsKind elements_kind, | 1294 ElementsKind elements_kind, |
| 1289 KeyedAccessGrowMode grow_mode) | 1295 KeyedAccessGrowMode grow_mode) |
| 1290 : is_js_array_(is_js_array), | 1296 : is_js_array_(is_js_array), |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 | 1504 |
| 1499 // The current function entry hook. | 1505 // The current function entry hook. |
| 1500 static FunctionEntryHook entry_hook_; | 1506 static FunctionEntryHook entry_hook_; |
| 1501 | 1507 |
| 1502 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1508 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 1503 }; | 1509 }; |
| 1504 | 1510 |
| 1505 } } // namespace v8::internal | 1511 } } // namespace v8::internal |
| 1506 | 1512 |
| 1507 #endif // V8_CODE_STUBS_H_ | 1513 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |