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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 V(ArrayNoArgumentConstructor) \ | 75 V(ArrayNoArgumentConstructor) \ |
76 V(ArraySingleArgumentConstructor) \ | 76 V(ArraySingleArgumentConstructor) \ |
77 V(ArrayNArgumentsConstructor) \ | 77 V(ArrayNArgumentsConstructor) \ |
78 V(KeyedStoreElement) \ | 78 V(KeyedStoreElement) \ |
79 V(DebuggerStatement) \ | 79 V(DebuggerStatement) \ |
80 V(NameDictionaryLookup) \ | 80 V(NameDictionaryLookup) \ |
81 V(ElementsTransitionAndStore) \ | 81 V(ElementsTransitionAndStore) \ |
82 V(TransitionElementsKind) \ | 82 V(TransitionElementsKind) \ |
83 V(StoreArrayLiteralElement) \ | 83 V(StoreArrayLiteralElement) \ |
84 V(StubFailureTrampoline) \ | 84 V(StubFailureTrampoline) \ |
85 V(ArrayConstructor) \ | |
85 V(ProfileEntryHook) \ | 86 V(ProfileEntryHook) \ |
86 /* IC Handler stubs */ \ | 87 /* IC Handler stubs */ \ |
87 V(LoadField) | 88 V(LoadField) |
88 | 89 |
89 // List of code stubs only used on ARM platforms. | 90 // List of code stubs only used on ARM platforms. |
90 #ifdef V8_TARGET_ARCH_ARM | 91 #ifdef V8_TARGET_ARCH_ARM |
91 #define CODE_STUB_LIST_ARM(V) \ | 92 #define CODE_STUB_LIST_ARM(V) \ |
92 V(GetProperty) \ | 93 V(GetProperty) \ |
93 V(SetProperty) \ | 94 V(SetProperty) \ |
94 V(InvokeBuiltin) \ | 95 V(InvokeBuiltin) \ |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 virtual void Generate(MacroAssembler* masm) = 0; | 258 virtual void Generate(MacroAssembler* masm) = 0; |
258 }; | 259 }; |
259 | 260 |
260 | 261 |
261 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; | 262 enum StubFunctionMode { NOT_JS_FUNCTION_STUB_MODE, JS_FUNCTION_STUB_MODE }; |
262 | 263 |
263 struct CodeStubInterfaceDescriptor { | 264 struct CodeStubInterfaceDescriptor { |
264 CodeStubInterfaceDescriptor() | 265 CodeStubInterfaceDescriptor() |
265 : register_param_count_(-1), | 266 : register_param_count_(-1), |
266 stack_parameter_count_(NULL), | 267 stack_parameter_count_(NULL), |
268 hint_stack_parameter_count_(-1), | |
267 function_mode_(NOT_JS_FUNCTION_STUB_MODE), | 269 function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
268 register_params_(NULL) { } | 270 register_params_(NULL) { } |
269 int register_param_count_; | 271 int register_param_count_; |
270 const Register* stack_parameter_count_; | 272 const Register* stack_parameter_count_; |
273 int hint_stack_parameter_count_; | |
271 StubFunctionMode function_mode_; | 274 StubFunctionMode function_mode_; |
272 Register* register_params_; | 275 Register* register_params_; |
273 Address deoptimization_handler_; | 276 Address deoptimization_handler_; |
274 | 277 |
275 int environment_length() const { | 278 int environment_length() const { |
276 if (stack_parameter_count_ != NULL) { | 279 if (stack_parameter_count_ != NULL) { |
277 return register_param_count_ + 1; | 280 return register_param_count_ + 1; |
278 } | 281 } |
279 return register_param_count_; | 282 return register_param_count_; |
280 } | 283 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 bool ReturnTrueFalseObject() const { | 583 bool ReturnTrueFalseObject() const { |
581 return (flags_ & kReturnTrueFalseObject) != 0; | 584 return (flags_ & kReturnTrueFalseObject) != 0; |
582 } | 585 } |
583 | 586 |
584 virtual void PrintName(StringStream* stream); | 587 virtual void PrintName(StringStream* stream); |
585 | 588 |
586 Flags flags_; | 589 Flags flags_; |
587 }; | 590 }; |
588 | 591 |
589 | 592 |
593 class ArrayConstructorStub: public PlatformCodeStub { | |
594 public: | |
595 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE }; | |
596 explicit ArrayConstructorStub(Isolate* isolate, int argument_count); | |
597 explicit ArrayConstructorStub(Isolate* isolate); | |
598 | |
599 void Generate(MacroAssembler* masm); | |
600 | |
601 private: | |
602 virtual CodeStub::Major MajorKey() { return ArrayConstructor; } | |
603 virtual int MinorKey() { return argument_count_; } | |
604 | |
605 ArgumentCountKey argument_count_; | |
606 }; | |
607 | |
608 | |
590 class MathPowStub: public PlatformCodeStub { | 609 class MathPowStub: public PlatformCodeStub { |
591 public: | 610 public: |
592 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; | 611 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; |
593 | 612 |
594 explicit MathPowStub(ExponentType exponent_type) | 613 explicit MathPowStub(ExponentType exponent_type) |
595 : exponent_type_(exponent_type) { } | 614 : exponent_type_(exponent_type) { } |
596 virtual void Generate(MacroAssembler* masm); | 615 virtual void Generate(MacroAssembler* masm); |
597 | 616 |
598 private: | 617 private: |
599 virtual CodeStub::Major MajorKey() { return MathPow; } | 618 virtual CodeStub::Major MajorKey() { return MathPow; } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1402 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 1421 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
1403 uint32_t bit_field_; | 1422 uint32_t bit_field_; |
1404 | 1423 |
1405 Major MajorKey() { return TransitionElementsKind; } | 1424 Major MajorKey() { return TransitionElementsKind; } |
1406 int MinorKey() { return bit_field_; } | 1425 int MinorKey() { return bit_field_; } |
1407 | 1426 |
1408 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1427 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
1409 }; | 1428 }; |
1410 | 1429 |
1411 | 1430 |
1412 class ArrayNoArgumentConstructorStub : public HydrogenCodeStub { | 1431 class ArrayConstructorStubBase : public HydrogenCodeStub { |
1413 public: | 1432 public: |
1414 ArrayNoArgumentConstructorStub() { | 1433 explicit ArrayConstructorStubBase(ElementsKind kind, |
Hannes Payer (out of office)
2013/04/18 11:14:39
explicit is only used in the one argument case
mvstanton
2013/04/18 13:39:26
Done.
| |
1434 AllocationSiteMode mode) { | |
1435 bit_field_ = ElementsKindBits::encode(kind) | | |
1436 AllocationSiteModeBits::encode(mode == TRACK_ALLOCATION_SITE); | |
1437 } | |
1438 | |
1439 int MinorKey() { return bit_field_; } | |
1440 | |
1441 ElementsKind elements_kind() const { | |
1442 return ElementsKindBits::decode(bit_field_); | |
1443 } | |
1444 | |
1445 AllocationSiteMode mode() const { | |
1446 return AllocationSiteModeBits::decode(bit_field_) | |
1447 ? TRACK_ALLOCATION_SITE | |
1448 : DONT_TRACK_ALLOCATION_SITE; | |
1449 } | |
1450 | |
1451 virtual bool IsPregenerated() { return true; } | |
1452 static void GenerateStubsAheadOfTime(Isolate* isolate); | |
1453 static void InstallDescriptors(Isolate* isolate); | |
1454 | |
1455 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | |
1456 static const int kPropertyCell = 0; | |
1457 | |
1458 private: | |
1459 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | |
1460 class AllocationSiteModeBits: public BitField<bool, 8, 1> {}; | |
1461 uint32_t bit_field_; | |
1462 | |
1463 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | |
1464 }; | |
1465 | |
1466 | |
1467 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | |
1468 public: | |
1469 explicit ArrayNoArgumentConstructorStub(ElementsKind kind, | |
1470 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) : | |
Hannes Payer (out of office)
2013/04/18 11:14:39
explicit is only used in the one argument case
mvstanton
2013/04/18 13:39:26
Done.
| |
1471 ArrayConstructorStubBase(kind, mode) { | |
1415 } | 1472 } |
1416 | 1473 |
1417 Major MajorKey() { return ArrayNoArgumentConstructor; } | 1474 Major MajorKey() { return ArrayNoArgumentConstructor; } |
1418 int MinorKey() { return 0; } | |
1419 | 1475 |
1420 virtual Handle<Code> GenerateCode(); | 1476 virtual Handle<Code> GenerateCode(); |
1421 | 1477 |
1422 virtual void InitializeInterfaceDescriptor( | 1478 virtual void InitializeInterfaceDescriptor( |
1423 Isolate* isolate, | 1479 Isolate* isolate, |
1424 CodeStubInterfaceDescriptor* descriptor); | 1480 CodeStubInterfaceDescriptor* descriptor); |
1425 | 1481 |
1426 private: | 1482 private: |
1427 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 1483 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
1428 }; | 1484 }; |
1429 | 1485 |
1430 | 1486 |
1431 class ArraySingleArgumentConstructorStub : public HydrogenCodeStub { | 1487 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
1432 public: | 1488 public: |
1433 ArraySingleArgumentConstructorStub() { | 1489 explicit ArraySingleArgumentConstructorStub(ElementsKind kind, |
1490 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) : | |
Hannes Payer (out of office)
2013/04/18 11:14:39
explicit is only used in the one argument case
mvstanton
2013/04/18 13:39:26
Done.
| |
1491 ArrayConstructorStubBase(kind, mode) { | |
1434 } | 1492 } |
1435 | 1493 |
1436 Major MajorKey() { return ArraySingleArgumentConstructor; } | 1494 Major MajorKey() { return ArraySingleArgumentConstructor; } |
1437 int MinorKey() { return 0; } | |
1438 | 1495 |
1439 virtual Handle<Code> GenerateCode(); | 1496 virtual Handle<Code> GenerateCode(); |
1440 | 1497 |
1441 virtual void InitializeInterfaceDescriptor( | 1498 virtual void InitializeInterfaceDescriptor( |
1442 Isolate* isolate, | 1499 Isolate* isolate, |
1443 CodeStubInterfaceDescriptor* descriptor); | 1500 CodeStubInterfaceDescriptor* descriptor); |
1444 | 1501 |
1445 private: | 1502 private: |
1446 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 1503 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
1447 }; | 1504 }; |
1448 | 1505 |
1449 | 1506 |
1450 class ArrayNArgumentsConstructorStub : public HydrogenCodeStub { | 1507 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
1451 public: | 1508 public: |
1452 ArrayNArgumentsConstructorStub() { | 1509 explicit ArrayNArgumentsConstructorStub(ElementsKind kind, |
1510 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) : | |
Hannes Payer (out of office)
2013/04/18 11:14:39
explicit is only used in the one argument case
mvstanton
2013/04/18 13:39:26
Done.
| |
1511 ArrayConstructorStubBase(kind, mode) { | |
1453 } | 1512 } |
1454 | 1513 |
1455 Major MajorKey() { return ArrayNArgumentsConstructor; } | 1514 Major MajorKey() { return ArrayNArgumentsConstructor; } |
1456 int MinorKey() { return 0; } | |
1457 | 1515 |
1458 virtual Handle<Code> GenerateCode(); | 1516 virtual Handle<Code> GenerateCode(); |
1459 | 1517 |
1460 virtual void InitializeInterfaceDescriptor( | 1518 virtual void InitializeInterfaceDescriptor( |
1461 Isolate* isolate, | 1519 Isolate* isolate, |
1462 CodeStubInterfaceDescriptor* descriptor); | 1520 CodeStubInterfaceDescriptor* descriptor); |
1463 | 1521 |
1464 private: | 1522 private: |
1465 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 1523 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
1466 }; | 1524 }; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1688 | 1746 |
1689 // The current function entry hook. | 1747 // The current function entry hook. |
1690 static FunctionEntryHook entry_hook_; | 1748 static FunctionEntryHook entry_hook_; |
1691 | 1749 |
1692 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1750 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1693 }; | 1751 }; |
1694 | 1752 |
1695 } } // namespace v8::internal | 1753 } } // namespace v8::internal |
1696 | 1754 |
1697 #endif // V8_CODE_STUBS_H_ | 1755 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |