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

Unified 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: With all ports done 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 side-by-side diff with in-line comments
Download patch
Index: src/code-stubs.h
diff --git a/src/code-stubs.h b/src/code-stubs.h
index 60c4fb9bd500082cbbb7a26dd0e5b36aee4c42a5..a93883574003c31f3687eb37fdd8366722122d89 100644
--- a/src/code-stubs.h
+++ b/src/code-stubs.h
@@ -82,6 +82,7 @@ namespace internal {
V(TransitionElementsKind) \
V(StoreArrayLiteralElement) \
V(StubFailureTrampoline) \
+ V(ArrayConstructor) \
V(ProfileEntryHook) \
/* IC Handler stubs */ \
V(LoadField)
@@ -264,10 +265,12 @@ struct CodeStubInterfaceDescriptor {
CodeStubInterfaceDescriptor()
: register_param_count_(-1),
stack_parameter_count_(NULL),
+ hint_stack_parameter_count_(-1),
function_mode_(NOT_JS_FUNCTION_STUB_MODE),
register_params_(NULL) { }
int register_param_count_;
const Register* stack_parameter_count_;
+ int hint_stack_parameter_count_;
StubFunctionMode function_mode_;
Register* register_params_;
Address deoptimization_handler_;
@@ -587,6 +590,22 @@ class InstanceofStub: public PlatformCodeStub {
};
+class ArrayConstructorStub: public PlatformCodeStub {
+ public:
+ enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE };
+ explicit ArrayConstructorStub(Isolate* isolate, int argument_count);
+ explicit ArrayConstructorStub(Isolate* isolate);
+
+ void Generate(MacroAssembler* masm);
+
+ private:
+ virtual CodeStub::Major MajorKey() { return ArrayConstructor; }
+ virtual int MinorKey() { return argument_count_; }
+
+ ArgumentCountKey argument_count_;
+};
+
+
class MathPowStub: public PlatformCodeStub {
public:
enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK};
@@ -1409,13 +1428,50 @@ class TransitionElementsKindStub : public HydrogenCodeStub {
};
-class ArrayNoArgumentConstructorStub : public HydrogenCodeStub {
+class ArrayConstructorStubBase : public HydrogenCodeStub {
+ public:
+ 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.
+ AllocationSiteMode mode) {
+ bit_field_ = ElementsKindBits::encode(kind) |
+ AllocationSiteModeBits::encode(mode == TRACK_ALLOCATION_SITE);
+ }
+
+ int MinorKey() { return bit_field_; }
+
+ ElementsKind elements_kind() const {
+ return ElementsKindBits::decode(bit_field_);
+ }
+
+ AllocationSiteMode mode() const {
+ return AllocationSiteModeBits::decode(bit_field_)
+ ? TRACK_ALLOCATION_SITE
+ : DONT_TRACK_ALLOCATION_SITE;
+ }
+
+ virtual bool IsPregenerated() { return true; }
+ static void GenerateStubsAheadOfTime(Isolate* isolate);
+ static void InstallDescriptors(Isolate* isolate);
+
+ // Parameters accessed via CodeStubGraphBuilder::GetParameter()
+ static const int kPropertyCell = 0;
+
+ private:
+ class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
+ class AllocationSiteModeBits: public BitField<bool, 8, 1> {};
+ uint32_t bit_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase);
+};
+
+
+class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase {
public:
- ArrayNoArgumentConstructorStub() {
+ explicit ArrayNoArgumentConstructorStub(ElementsKind kind,
+ 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.
+ ArrayConstructorStubBase(kind, mode) {
}
Major MajorKey() { return ArrayNoArgumentConstructor; }
- int MinorKey() { return 0; }
virtual Handle<Code> GenerateCode();
@@ -1428,13 +1484,14 @@ class ArrayNoArgumentConstructorStub : public HydrogenCodeStub {
};
-class ArraySingleArgumentConstructorStub : public HydrogenCodeStub {
+class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase {
public:
- ArraySingleArgumentConstructorStub() {
+ explicit ArraySingleArgumentConstructorStub(ElementsKind kind,
+ 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.
+ ArrayConstructorStubBase(kind, mode) {
}
Major MajorKey() { return ArraySingleArgumentConstructor; }
- int MinorKey() { return 0; }
virtual Handle<Code> GenerateCode();
@@ -1447,13 +1504,14 @@ class ArraySingleArgumentConstructorStub : public HydrogenCodeStub {
};
-class ArrayNArgumentsConstructorStub : public HydrogenCodeStub {
+class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase {
public:
- ArrayNArgumentsConstructorStub() {
+ explicit ArrayNArgumentsConstructorStub(ElementsKind kind,
+ 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.
+ ArrayConstructorStubBase(kind, mode) {
}
Major MajorKey() { return ArrayNArgumentsConstructor; }
- int MinorKey() { return 0; }
virtual Handle<Code> GenerateCode();

Powered by Google App Engine
This is Rietveld 408576698