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

Side by Side Diff: src/code-stubs.h

Issue 12385014: Hydrogen stubs for array constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More efficient code when number of arguments is known Created 7 years, 8 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 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
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 bool ReturnTrueFalseObject() const { 581 bool ReturnTrueFalseObject() const {
581 return (flags_ & kReturnTrueFalseObject) != 0; 582 return (flags_ & kReturnTrueFalseObject) != 0;
582 } 583 }
583 584
584 virtual void PrintName(StringStream* stream); 585 virtual void PrintName(StringStream* stream);
585 586
586 Flags flags_; 587 Flags flags_;
587 }; 588 };
588 589
589 590
591 class ArrayConstructorStub: public PlatformCodeStub {
592 public:
593 enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE };
594 explicit ArrayConstructorStub(Isolate* isolate, int argument_count);
595 explicit ArrayConstructorStub(Isolate* isolate);
596
597 void Generate(MacroAssembler* masm);
598
599 private:
600 virtual CodeStub::Major MajorKey() { return ArrayConstructor; }
601 virtual int MinorKey() { return argument_count_; }
602
603 ArgumentCountKey argument_count_;
604 };
605
606
590 class MathPowStub: public PlatformCodeStub { 607 class MathPowStub: public PlatformCodeStub {
591 public: 608 public:
592 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; 609 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK};
593 610
594 explicit MathPowStub(ExponentType exponent_type) 611 explicit MathPowStub(ExponentType exponent_type)
595 : exponent_type_(exponent_type) { } 612 : exponent_type_(exponent_type) { }
596 virtual void Generate(MacroAssembler* masm); 613 virtual void Generate(MacroAssembler* masm);
597 614
598 private: 615 private:
599 virtual CodeStub::Major MajorKey() { return MathPow; } 616 virtual CodeStub::Major MajorKey() { return MathPow; }
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; 1419 class ToKindBits: public BitField<ElementsKind, 0, 8> {};
1403 uint32_t bit_field_; 1420 uint32_t bit_field_;
1404 1421
1405 Major MajorKey() { return TransitionElementsKind; } 1422 Major MajorKey() { return TransitionElementsKind; }
1406 int MinorKey() { return bit_field_; } 1423 int MinorKey() { return bit_field_; }
1407 1424
1408 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); 1425 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub);
1409 }; 1426 };
1410 1427
1411 1428
1412 class ArrayNoArgumentConstructorStub : public HydrogenCodeStub { 1429 class ArrayConstructorStubBase : public HydrogenCodeStub {
1413 public: 1430 public:
1414 ArrayNoArgumentConstructorStub() { 1431 explicit ArrayConstructorStubBase(ElementsKind kind) {
1432 bit_field_ = ElementsKindBits::encode(kind);
1433 }
1434
1435 int MinorKey() { return bit_field_; }
1436
1437 ElementsKind elements_kind() const {
1438 return ElementsKindBits::decode(bit_field_);
1439 }
1440
1441 virtual bool IsPregenerated() { return true; }
1442 static void GenerateStubsAheadOfTime(Isolate* isolate);
1443 static void InstallDescriptors(Isolate* isolate);
1444
1445 // Parameters accessed via CodeStubGraphBuilder::GetParameter()
1446 static const int kPropertyCell = 0;
1447 private:
1448 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
1449 uint32_t bit_field_;
1450
1451 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase);
1452 };
1453
1454
1455 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
1456 public:
1457 explicit ArrayNoArgumentConstructorStub(ElementsKind kind) :
1458 ArrayConstructorStubBase(kind) {
1415 } 1459 }
1416 1460
1417 Major MajorKey() { return ArrayNoArgumentConstructor; } 1461 Major MajorKey() { return ArrayNoArgumentConstructor; }
1418 int MinorKey() { return 0; }
1419 1462
1420 virtual Handle<Code> GenerateCode(); 1463 virtual Handle<Code> GenerateCode();
1421 1464
1422 virtual void InitializeInterfaceDescriptor( 1465 virtual void InitializeInterfaceDescriptor(
1423 Isolate* isolate, 1466 Isolate* isolate,
1424 CodeStubInterfaceDescriptor* descriptor); 1467 CodeStubInterfaceDescriptor* descriptor);
1425 1468
1426 private: 1469 private:
1427 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); 1470 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub);
1428 }; 1471 };
1429 1472
1430 1473
1431 class ArraySingleArgumentConstructorStub : public HydrogenCodeStub { 1474 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
1432 public: 1475 public:
1433 ArraySingleArgumentConstructorStub() { 1476 explicit ArraySingleArgumentConstructorStub(ElementsKind kind) :
1477 ArrayConstructorStubBase(kind) {
1434 } 1478 }
1435 1479
1436 Major MajorKey() { return ArraySingleArgumentConstructor; } 1480 Major MajorKey() { return ArraySingleArgumentConstructor; }
1437 int MinorKey() { return 0; }
1438 1481
1439 virtual Handle<Code> GenerateCode(); 1482 virtual Handle<Code> GenerateCode();
1440 1483
1441 virtual void InitializeInterfaceDescriptor( 1484 virtual void InitializeInterfaceDescriptor(
1442 Isolate* isolate, 1485 Isolate* isolate,
1443 CodeStubInterfaceDescriptor* descriptor); 1486 CodeStubInterfaceDescriptor* descriptor);
1444 1487
1445 private: 1488 private:
1446 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); 1489 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub);
1447 }; 1490 };
1448 1491
1449 1492
1450 class ArrayNArgumentsConstructorStub : public HydrogenCodeStub { 1493 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
1451 public: 1494 public:
1452 ArrayNArgumentsConstructorStub() { 1495 explicit ArrayNArgumentsConstructorStub(ElementsKind kind) :
1496 ArrayConstructorStubBase(kind) {
1453 } 1497 }
1454 1498
1455 Major MajorKey() { return ArrayNArgumentsConstructor; } 1499 Major MajorKey() { return ArrayNArgumentsConstructor; }
1456 int MinorKey() { return 0; }
1457 1500
1458 virtual Handle<Code> GenerateCode(); 1501 virtual Handle<Code> GenerateCode();
1459 1502
1460 virtual void InitializeInterfaceDescriptor( 1503 virtual void InitializeInterfaceDescriptor(
1461 Isolate* isolate, 1504 Isolate* isolate,
1462 CodeStubInterfaceDescriptor* descriptor); 1505 CodeStubInterfaceDescriptor* descriptor);
1463 1506
1464 private: 1507 private:
1465 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); 1508 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub);
1466 }; 1509 };
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 1731
1689 // The current function entry hook. 1732 // The current function entry hook.
1690 static FunctionEntryHook entry_hook_; 1733 static FunctionEntryHook entry_hook_;
1691 1734
1692 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 1735 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
1693 }; 1736 };
1694 1737
1695 } } // namespace v8::internal 1738 } } // namespace v8::internal
1696 1739
1697 #endif // V8_CODE_STUBS_H_ 1740 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698