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

Side by Side Diff: src/hydrogen-instructions.h

Issue 9403018: Implement fast literal support in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Daniel Clifford. Created 8 years, 10 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 V(CompareMap) \ 96 V(CompareMap) \
97 V(CompareConstantEqAndBranch) \ 97 V(CompareConstantEqAndBranch) \
98 V(Constant) \ 98 V(Constant) \
99 V(Context) \ 99 V(Context) \
100 V(DeclareGlobals) \ 100 V(DeclareGlobals) \
101 V(DeleteProperty) \ 101 V(DeleteProperty) \
102 V(Deoptimize) \ 102 V(Deoptimize) \
103 V(Div) \ 103 V(Div) \
104 V(ElementsKind) \ 104 V(ElementsKind) \
105 V(EnterInlined) \ 105 V(EnterInlined) \
106 V(FastLiteral) \
106 V(FixedArrayBaseLength) \ 107 V(FixedArrayBaseLength) \
107 V(ForceRepresentation) \ 108 V(ForceRepresentation) \
108 V(FunctionLiteral) \ 109 V(FunctionLiteral) \
109 V(GetCachedArrayIndex) \ 110 V(GetCachedArrayIndex) \
110 V(GlobalObject) \ 111 V(GlobalObject) \
111 V(GlobalReceiver) \ 112 V(GlobalReceiver) \
112 V(Goto) \ 113 V(Goto) \
113 V(HasCachedArrayIndexAndBranch) \ 114 V(HasCachedArrayIndexAndBranch) \
114 V(HasInstanceTypeAndBranch) \ 115 V(HasInstanceTypeAndBranch) \
115 V(In) \ 116 V(In) \
(...skipping 17 matching lines...) Expand all
133 V(LoadGlobalGeneric) \ 134 V(LoadGlobalGeneric) \
134 V(LoadKeyedFastDoubleElement) \ 135 V(LoadKeyedFastDoubleElement) \
135 V(LoadKeyedFastElement) \ 136 V(LoadKeyedFastElement) \
136 V(LoadKeyedGeneric) \ 137 V(LoadKeyedGeneric) \
137 V(LoadKeyedSpecializedArrayElement) \ 138 V(LoadKeyedSpecializedArrayElement) \
138 V(LoadNamedField) \ 139 V(LoadNamedField) \
139 V(LoadNamedFieldPolymorphic) \ 140 V(LoadNamedFieldPolymorphic) \
140 V(LoadNamedGeneric) \ 141 V(LoadNamedGeneric) \
141 V(Mod) \ 142 V(Mod) \
142 V(Mul) \ 143 V(Mul) \
143 V(ObjectLiteralFast) \ 144 V(ObjectLiteral) \
144 V(ObjectLiteralGeneric) \
145 V(OsrEntry) \ 145 V(OsrEntry) \
146 V(OuterContext) \ 146 V(OuterContext) \
147 V(Parameter) \ 147 V(Parameter) \
148 V(Power) \ 148 V(Power) \
149 V(PushArgument) \ 149 V(PushArgument) \
150 V(Random) \ 150 V(Random) \
151 V(RegExpLiteral) \ 151 V(RegExpLiteral) \
152 V(Return) \ 152 V(Return) \
153 V(Sar) \ 153 V(Sar) \
154 V(Shl) \ 154 V(Shl) \
(...skipping 4195 matching lines...) Expand 10 before | Expand all | Expand 10 after
4350 4350
4351 int literal_index() const { return literal_index_; } 4351 int literal_index() const { return literal_index_; }
4352 int depth() const { return depth_; } 4352 int depth() const { return depth_; }
4353 4353
4354 private: 4354 private:
4355 int literal_index_; 4355 int literal_index_;
4356 int depth_; 4356 int depth_;
4357 }; 4357 };
4358 4358
4359 4359
4360 class HFastLiteral: public HMaterializedLiteral<1> {
4361 public:
4362 HFastLiteral(HValue* context,
4363 Handle<JSObject> boilerplate,
4364 int total_size,
4365 int literal_index,
4366 int depth)
4367 : HMaterializedLiteral<1>(literal_index, depth),
4368 boilerplate_(boilerplate),
4369 total_size_(total_size) {
4370 SetOperandAt(0, context);
4371 }
4372
4373 // Maximum depth and total number of elements and properties for literal
4374 // graphs to be considered for fast deep-copying.
4375 static const int kMaxLiteralDepth = 3;
4376 static const int kMaxLiteralProperties = 8;
4377
4378 HValue* context() { return OperandAt(0); }
4379 Handle<JSObject> boilerplate() const { return boilerplate_; }
4380 int total_size() const { return total_size_; }
4381
4382 virtual Representation RequiredInputRepresentation(int index) {
4383 return Representation::Tagged();
4384 }
4385 virtual HType CalculateInferredType();
4386
4387 DECLARE_CONCRETE_INSTRUCTION(FastLiteral)
4388
4389 private:
4390 Handle<JSObject> boilerplate_;
4391 int total_size_;
4392 };
4393
4394
4360 class HArrayLiteral: public HMaterializedLiteral<1> { 4395 class HArrayLiteral: public HMaterializedLiteral<1> {
4361 public: 4396 public:
4362 HArrayLiteral(HValue* context, 4397 HArrayLiteral(HValue* context,
4363 Handle<HeapObject> boilerplate_object, 4398 Handle<HeapObject> boilerplate_object,
4364 int length, 4399 int length,
4365 int literal_index, 4400 int literal_index,
4366 int depth) 4401 int depth)
4367 : HMaterializedLiteral<1>(literal_index, depth), 4402 : HMaterializedLiteral<1>(literal_index, depth),
4368 length_(length), 4403 length_(length),
4369 boilerplate_object_(boilerplate_object) { 4404 boilerplate_object_(boilerplate_object) {
(...skipping 18 matching lines...) Expand all
4388 virtual HType CalculateInferredType(); 4423 virtual HType CalculateInferredType();
4389 4424
4390 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral) 4425 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral)
4391 4426
4392 private: 4427 private:
4393 int length_; 4428 int length_;
4394 Handle<HeapObject> boilerplate_object_; 4429 Handle<HeapObject> boilerplate_object_;
4395 }; 4430 };
4396 4431
4397 4432
4398 class HObjectLiteralFast: public HMaterializedLiteral<1> { 4433 class HObjectLiteral: public HMaterializedLiteral<1> {
4399 public: 4434 public:
4400 HObjectLiteralFast(HValue* context, 4435 HObjectLiteral(HValue* context,
4401 Handle<JSObject> boilerplate, 4436 Handle<FixedArray> constant_properties,
4402 int total_size, 4437 bool fast_elements,
4403 int literal_index, 4438 int literal_index,
4404 int depth) 4439 int depth,
4405 : HMaterializedLiteral<1>(literal_index, depth), 4440 bool has_function)
4406 boilerplate_(boilerplate),
4407 total_size_(total_size) {
4408 SetOperandAt(0, context);
4409 }
4410
4411 // Maximum depth and total number of properties for object literal
4412 // graphs to be considered for fast deep-copying.
4413 static const int kMaxObjectLiteralDepth = 3;
4414 static const int kMaxObjectLiteralProperties = 8;
4415
4416 HValue* context() { return OperandAt(0); }
4417 Handle<JSObject> boilerplate() const { return boilerplate_; }
4418 int total_size() const { return total_size_; }
4419
4420 virtual Representation RequiredInputRepresentation(int index) {
4421 return Representation::Tagged();
4422 }
4423 virtual HType CalculateInferredType();
4424
4425 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralFast)
4426
4427 private:
4428 Handle<JSObject> boilerplate_;
4429 int total_size_;
4430 };
4431
4432
4433 class HObjectLiteralGeneric: public HMaterializedLiteral<1> {
4434 public:
4435 HObjectLiteralGeneric(HValue* context,
4436 Handle<FixedArray> constant_properties,
4437 bool fast_elements,
4438 int literal_index,
4439 int depth,
4440 bool has_function)
4441 : HMaterializedLiteral<1>(literal_index, depth), 4441 : HMaterializedLiteral<1>(literal_index, depth),
4442 constant_properties_(constant_properties), 4442 constant_properties_(constant_properties),
4443 fast_elements_(fast_elements), 4443 fast_elements_(fast_elements),
4444 has_function_(has_function) { 4444 has_function_(has_function) {
4445 SetOperandAt(0, context); 4445 SetOperandAt(0, context);
4446 } 4446 }
4447 4447
4448 HValue* context() { return OperandAt(0); } 4448 HValue* context() { return OperandAt(0); }
4449 Handle<FixedArray> constant_properties() const { 4449 Handle<FixedArray> constant_properties() const {
4450 return constant_properties_; 4450 return constant_properties_;
4451 } 4451 }
4452 bool fast_elements() const { return fast_elements_; } 4452 bool fast_elements() const { return fast_elements_; }
4453 bool has_function() const { return has_function_; } 4453 bool has_function() const { return has_function_; }
4454 4454
4455 virtual Representation RequiredInputRepresentation(int index) { 4455 virtual Representation RequiredInputRepresentation(int index) {
4456 return Representation::Tagged(); 4456 return Representation::Tagged();
4457 } 4457 }
4458 virtual HType CalculateInferredType(); 4458 virtual HType CalculateInferredType();
4459 4459
4460 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteralGeneric) 4460 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral)
4461 4461
4462 private: 4462 private:
4463 Handle<FixedArray> constant_properties_; 4463 Handle<FixedArray> constant_properties_;
4464 bool fast_elements_; 4464 bool fast_elements_;
4465 bool has_function_; 4465 bool has_function_;
4466 }; 4466 };
4467 4467
4468 4468
4469 class HRegExpLiteral: public HMaterializedLiteral<1> { 4469 class HRegExpLiteral: public HMaterializedLiteral<1> {
4470 public: 4470 public:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4545 DECLARE_CONCRETE_INSTRUCTION(Typeof) 4545 DECLARE_CONCRETE_INSTRUCTION(Typeof)
4546 }; 4546 };
4547 4547
4548 4548
4549 class HToFastProperties: public HUnaryOperation { 4549 class HToFastProperties: public HUnaryOperation {
4550 public: 4550 public:
4551 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 4551 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
4552 // This instruction is not marked as having side effects, but 4552 // This instruction is not marked as having side effects, but
4553 // changes the map of the input operand. Use it only when creating 4553 // changes the map of the input operand. Use it only when creating
4554 // object literals. 4554 // object literals.
4555 ASSERT(value->IsObjectLiteralGeneric() || value->IsObjectLiteralFast()); 4555 ASSERT(value->IsObjectLiteral() || value->IsFastLiteral());
4556 set_representation(Representation::Tagged()); 4556 set_representation(Representation::Tagged());
4557 } 4557 }
4558 4558
4559 virtual Representation RequiredInputRepresentation(int index) { 4559 virtual Representation RequiredInputRepresentation(int index) {
4560 return Representation::Tagged(); 4560 return Representation::Tagged();
4561 } 4561 }
4562 4562
4563 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 4563 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
4564 }; 4564 };
4565 4565
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4625 4625
4626 DECLARE_CONCRETE_INSTRUCTION(In) 4626 DECLARE_CONCRETE_INSTRUCTION(In)
4627 }; 4627 };
4628 4628
4629 #undef DECLARE_INSTRUCTION 4629 #undef DECLARE_INSTRUCTION
4630 #undef DECLARE_CONCRETE_INSTRUCTION 4630 #undef DECLARE_CONCRETE_INSTRUCTION
4631 4631
4632 } } // namespace v8::internal 4632 } } // namespace v8::internal
4633 4633
4634 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4634 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698