Chromium Code Reviews

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

Issue 368263003: Use a stub in crankshaft for grow store arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Performance fixes. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_
6 #define V8_HYDROGEN_INSTRUCTIONS_H_ 6 #define V8_HYDROGEN_INSTRUCTIONS_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 2289 matching lines...)
2300 int argument_count, 2300 int argument_count,
2301 const CallInterfaceDescriptor* descriptor, 2301 const CallInterfaceDescriptor* descriptor,
2302 const Vector<HValue*>& operands) { 2302 const Vector<HValue*>& operands) {
2303 ASSERT(operands.length() == descriptor->environment_length()); 2303 ASSERT(operands.length() == descriptor->environment_length());
2304 HCallWithDescriptor* res = 2304 HCallWithDescriptor* res =
2305 new(zone) HCallWithDescriptor(target, argument_count, 2305 new(zone) HCallWithDescriptor(target, argument_count,
2306 descriptor, operands, zone); 2306 descriptor, operands, zone);
2307 return res; 2307 return res;
2308 } 2308 }
2309 2309
2310 static HCallWithDescriptor* New(Zone* zone, HValue* context,
2311 HValue* target,
2312 int argument_count,
2313 const CodeStubInterfaceDescriptor* descriptor,
2314 const Vector<HValue*>& operands) {
2315 ASSERT(operands.length() == descriptor->environment_length());
2316 HCallWithDescriptor* res =
2317 new(zone) HCallWithDescriptor(target, argument_count,
2318 descriptor, operands, context,
2319 zone);
2320 return res;
2321 }
2322
2310 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } 2323 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); }
2311 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { 2324 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE {
2312 return values_[index]; 2325 return values_[index];
2313 } 2326 }
2314 2327
2315 virtual Representation RequiredInputRepresentation( 2328 virtual Representation RequiredInputRepresentation(
2316 int index) V8_FINAL V8_OVERRIDE { 2329 int index) V8_FINAL V8_OVERRIDE {
2330 if (is_stub_) {
2331 if (index < 2) {
danno 2014/07/11 12:30:30 I think a little more comments/constants are neede
mvstanton 2014/07/21 09:41:17 Happily, we've now repaired this whole area so thi
2332 return Representation::Tagged();
2333 } else {
2334 int par_index = index - 2;
2335 ASSERT(par_index < stub_descriptor_->environment_length());
2336 return stub_descriptor_->GetParameterRepresentation(par_index);
2337 }
2338 }
2339
2340 ASSERT(!is_stub_);
2317 if (index == 0) { 2341 if (index == 0) {
2318 return Representation::Tagged(); 2342 return Representation::Tagged();
2319 } else { 2343 } else {
2320 int par_index = index - 1; 2344 int par_index = index - 1;
2321 ASSERT(par_index < descriptor_->environment_length()); 2345 ASSERT(par_index < call_descriptor_->environment_length());
2322 return descriptor_->GetParameterRepresentation(par_index); 2346 return call_descriptor_->GetParameterRepresentation(par_index);
2323 } 2347 }
2324 } 2348 }
2325 2349
2326 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) 2350 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor)
2327 2351
2328 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { 2352 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE {
2329 return HType::Tagged(); 2353 return HType::Tagged();
2330 } 2354 }
2331 2355
2332 virtual int argument_count() const { 2356 virtual int argument_count() const {
2333 return argument_count_; 2357 return argument_count_;
2334 } 2358 }
2335 2359
2336 virtual int argument_delta() const V8_OVERRIDE { 2360 virtual int argument_delta() const V8_OVERRIDE {
2337 return -argument_count_; 2361 return -argument_count_;
2338 } 2362 }
2339 2363
2340 const CallInterfaceDescriptor* descriptor() const { 2364 bool is_stub() const { return is_stub_; }
2341 return descriptor_; 2365
2366 const CallInterfaceDescriptor* call_descriptor() const {
2367 ASSERT(!is_stub_);
2368 return call_descriptor_;
2369 }
2370
2371 const CodeStubInterfaceDescriptor* stub_descriptor() const {
2372 ASSERT(is_stub_);
2373 return stub_descriptor_;
2342 } 2374 }
2343 2375
2344 HValue* target() { 2376 HValue* target() {
2345 return OperandAt(0); 2377 return OperandAt(0);
2346 } 2378 }
2347 2379
2380 HValue* context() {
2381 ASSERT(is_stub_);
2382 return OperandAt(1);
2383 }
2384
2348 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2385 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2349 2386
2350 private: 2387 private:
2351 // The argument count includes the receiver. 2388 // The argument count includes the receiver.
2352 HCallWithDescriptor(HValue* target, 2389 HCallWithDescriptor(HValue* target,
2353 int argument_count, 2390 int argument_count,
2354 const CallInterfaceDescriptor* descriptor, 2391 const CallInterfaceDescriptor* descriptor,
2355 const Vector<HValue*>& operands, 2392 const Vector<HValue*>& operands,
2356 Zone* zone) 2393 Zone* zone)
2357 : descriptor_(descriptor), 2394 : is_stub_(false),
2395 call_descriptor_(descriptor),
2358 values_(descriptor->environment_length() + 1, zone) { 2396 values_(descriptor->environment_length() + 1, zone) {
2359 argument_count_ = argument_count; 2397 argument_count_ = argument_count;
2360 AddOperand(target, zone); 2398 AddOperand(target, zone);
2361 for (int i = 0; i < operands.length(); i++) { 2399 for (int i = 0; i < operands.length(); i++) {
2362 AddOperand(operands[i], zone); 2400 AddOperand(operands[i], zone);
2363 } 2401 }
2364 this->set_representation(Representation::Tagged()); 2402 this->set_representation(Representation::Tagged());
2365 this->SetAllSideEffects(); 2403 this->SetAllSideEffects();
2366 } 2404 }
2367 2405
2406 // The argument count includes the receiver.
2407 HCallWithDescriptor(HValue* target,
2408 int argument_count,
2409 const CodeStubInterfaceDescriptor* descriptor,
2410 const Vector<HValue*>& operands,
2411 HValue* context,
2412 Zone* zone)
2413 : is_stub_(true),
2414 stub_descriptor_(descriptor),
2415 values_(descriptor->environment_length() + 2, zone) {
2416 argument_count_ = argument_count;
2417 AddOperand(target, zone);
2418 AddOperand(context, zone);
2419 for (int i = 0; i < operands.length(); i++) {
2420 AddOperand(operands[i], zone);
2421 }
2422 this->set_representation(Representation::Tagged());
2423 this->SetAllSideEffects();
2424 }
2425
2368 void AddOperand(HValue* v, Zone* zone) { 2426 void AddOperand(HValue* v, Zone* zone) {
2369 values_.Add(NULL, zone); 2427 values_.Add(NULL, zone);
2370 SetOperandAt(values_.length() - 1, v); 2428 SetOperandAt(values_.length() - 1, v);
2371 } 2429 }
2372 2430
2373 void InternalSetOperandAt(int index, 2431 void InternalSetOperandAt(int index,
2374 HValue* value) V8_FINAL V8_OVERRIDE { 2432 HValue* value) V8_FINAL V8_OVERRIDE {
2375 values_[index] = value; 2433 values_[index] = value;
2376 } 2434 }
2377 2435
2378 const CallInterfaceDescriptor* descriptor_; 2436 const bool is_stub_;
2437 union {
2438 const CodeStubInterfaceDescriptor* stub_descriptor_;
2439 const CallInterfaceDescriptor* call_descriptor_;
2440 };
2379 ZoneList<HValue*> values_; 2441 ZoneList<HValue*> values_;
2380 int argument_count_; 2442 int argument_count_;
2381 }; 2443 };
2382 2444
2383 2445
2384 class HInvokeFunction V8_FINAL : public HBinaryCall { 2446 class HInvokeFunction V8_FINAL : public HBinaryCall {
2385 public: 2447 public:
2386 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); 2448 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int);
2387 2449
2388 HInvokeFunction(HValue* context, 2450 HInvokeFunction(HValue* context,
(...skipping 5398 matching lines...)
7787 }; 7849 };
7788 7850
7789 7851
7790 7852
7791 #undef DECLARE_INSTRUCTION 7853 #undef DECLARE_INSTRUCTION
7792 #undef DECLARE_CONCRETE_INSTRUCTION 7854 #undef DECLARE_CONCRETE_INSTRUCTION
7793 7855
7794 } } // namespace v8::internal 7856 } } // namespace v8::internal
7795 7857
7796 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7858 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW

Powered by Google App Engine