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

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

Issue 104663004: Preview of a first step towards unification of hydrogen calls (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merge fix Created 6 years, 11 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 V(Allocate) \ 70 V(Allocate) \
71 V(ApplyArguments) \ 71 V(ApplyArguments) \
72 V(ArgumentsElements) \ 72 V(ArgumentsElements) \
73 V(ArgumentsLength) \ 73 V(ArgumentsLength) \
74 V(ArgumentsObject) \ 74 V(ArgumentsObject) \
75 V(Bitwise) \ 75 V(Bitwise) \
76 V(BlockEntry) \ 76 V(BlockEntry) \
77 V(BoundsCheck) \ 77 V(BoundsCheck) \
78 V(BoundsCheckBaseIndexInformation) \ 78 V(BoundsCheckBaseIndexInformation) \
79 V(Branch) \ 79 V(Branch) \
80 V(CallConstantFunction) \ 80 V(CallWithDescriptor) \
81 V(CallJSFunction) \
81 V(CallFunction) \ 82 V(CallFunction) \
82 V(CallKeyed) \
83 V(CallKnownGlobal) \
84 V(CallNamed) \
85 V(CallNew) \ 83 V(CallNew) \
86 V(CallNewArray) \ 84 V(CallNewArray) \
87 V(CallRuntime) \ 85 V(CallRuntime) \
88 V(CallStub) \ 86 V(CallStub) \
89 V(CapturedObject) \ 87 V(CapturedObject) \
90 V(Change) \ 88 V(Change) \
91 V(CheckHeapObject) \ 89 V(CheckHeapObject) \
92 V(CheckInstanceType) \ 90 V(CheckInstanceType) \
93 V(CheckMaps) \ 91 V(CheckMaps) \
94 V(CheckMapValue) \ 92 V(CheckMapValue) \
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 virtual Representation RequiredInputRepresentation( 2270 virtual Representation RequiredInputRepresentation(
2273 int index) V8_FINAL V8_OVERRIDE { 2271 int index) V8_FINAL V8_OVERRIDE {
2274 return Representation::Tagged(); 2272 return Representation::Tagged();
2275 } 2273 }
2276 2274
2277 HValue* first() { return OperandAt(0); } 2275 HValue* first() { return OperandAt(0); }
2278 HValue* second() { return OperandAt(1); } 2276 HValue* second() { return OperandAt(1); }
2279 }; 2277 };
2280 2278
2281 2279
2280 class HCallJSFunction V8_FINAL : public HCall<1> {
2281 public:
2282 static HCallJSFunction* New(Zone* zone,
2283 HValue* context,
2284 HValue* function,
2285 int argument_count,
2286 bool pass_argument_count);
2287
2288 HValue* function() { return OperandAt(0); }
2289
2290 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2291
2292 virtual Representation RequiredInputRepresentation(
2293 int index) V8_FINAL V8_OVERRIDE {
2294 ASSERT(index == 0);
2295 return Representation::Tagged();
2296 }
2297
2298 bool pass_argument_count() const { return pass_argument_count_; }
2299
2300 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE {
2301 return has_stack_check_;
2302 }
2303
2304 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction)
2305
2306 private:
2307 // The argument count includes the receiver.
2308 HCallJSFunction(HValue* function,
2309 int argument_count,
2310 bool pass_argument_count,
2311 bool has_stack_check)
2312 : HCall<1>(argument_count),
2313 pass_argument_count_(pass_argument_count),
2314 has_stack_check_(has_stack_check) {
2315 SetOperandAt(0, function);
2316 }
2317
2318 bool pass_argument_count_;
2319 bool has_stack_check_;
2320 };
2321
2322
2323 class HCallWithDescriptor V8_FINAL : public HInstruction {
2324 public:
2325 static HCallWithDescriptor* New(Zone* zone, HValue* context,
2326 HValue* target,
2327 int argument_count,
2328 const CallInterfaceDescriptor* descriptor,
2329 Vector<HValue*>& operands) {
2330 ASSERT(operands.length() == descriptor->environment_length());
2331 HCallWithDescriptor* res =
2332 new(zone) HCallWithDescriptor(target, argument_count,
2333 descriptor, operands, zone);
2334 return res;
2335 }
2336
2337 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); }
2338 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE {
2339 return values_[index];
2340 }
2341
2342 virtual Representation RequiredInputRepresentation(
2343 int index) V8_FINAL V8_OVERRIDE {
2344 if (index == 0) {
2345 return Representation::Tagged();
2346 } else {
2347 int par_index = index - 1;
2348 ASSERT(par_index < descriptor_->environment_length());
2349 return descriptor_->GetParameterRepresentation(par_index);
2350 }
2351 }
2352
2353 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor)
2354
2355 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE {
2356 return HType::Tagged();
2357 }
2358
2359 virtual int argument_count() const {
2360 return argument_count_;
2361 }
2362
2363 virtual int argument_delta() const V8_OVERRIDE {
2364 return -argument_count_;
2365 }
2366
2367 const CallInterfaceDescriptor* descriptor() const {
2368 return descriptor_;
2369 }
2370
2371 HValue* target() {
2372 return OperandAt(0);
2373 }
2374
2375 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; }
2376
2377 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2378
2379 private:
2380 // The argument count includes the receiver.
2381 HCallWithDescriptor(HValue* target,
2382 int argument_count,
2383 const CallInterfaceDescriptor* descriptor,
2384 Vector<HValue*>& operands,
2385 Zone* zone)
2386 : descriptor_(descriptor),
2387 values_(descriptor->environment_length() + 1, zone) {
2388 argument_count_ = argument_count;
2389 AddOperand(target, zone);
2390 for (int i = 0; i < operands.length(); i++) {
2391 AddOperand(operands[i], zone);
2392 }
2393 this->set_representation(Representation::Tagged());
2394 this->SetAllSideEffects();
2395 }
2396
2397 void AddOperand(HValue* v, Zone* zone) {
2398 values_.Add(NULL, zone);
2399 SetOperandAt(values_.length() - 1, v);
2400 }
2401
2402 void InternalSetOperandAt(int index,
2403 HValue* value) V8_FINAL V8_OVERRIDE {
2404 values_[index] = value;
2405 }
2406
2407 const CallInterfaceDescriptor* descriptor_;
2408 ZoneList<HValue*> values_;
2409 int argument_count_;
2410 };
2411
2412
2282 class HInvokeFunction V8_FINAL : public HBinaryCall { 2413 class HInvokeFunction V8_FINAL : public HBinaryCall {
2283 public: 2414 public:
2284 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); 2415 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int);
2285 2416
2286 HInvokeFunction(HValue* context, 2417 HInvokeFunction(HValue* context,
2287 HValue* function, 2418 HValue* function,
2288 Handle<JSFunction> known_function, 2419 Handle<JSFunction> known_function,
2289 int argument_count) 2420 int argument_count)
2290 : HBinaryCall(context, function, argument_count), 2421 : HBinaryCall(context, function, argument_count),
2291 known_function_(known_function) { 2422 known_function_(known_function) {
(...skipping 29 matching lines...) Expand all
2321 : HBinaryCall(context, function, argument_count), 2452 : HBinaryCall(context, function, argument_count),
2322 has_stack_check_(false) { 2453 has_stack_check_(false) {
2323 } 2454 }
2324 2455
2325 Handle<JSFunction> known_function_; 2456 Handle<JSFunction> known_function_;
2326 int formal_parameter_count_; 2457 int formal_parameter_count_;
2327 bool has_stack_check_; 2458 bool has_stack_check_;
2328 }; 2459 };
2329 2460
2330 2461
2331 class HCallConstantFunction V8_FINAL : public HCall<0> {
2332 public:
2333 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction,
2334 Handle<JSFunction>,
2335 int);
2336
2337 Handle<JSFunction> function() const { return function_; }
2338 int formal_parameter_count() const { return formal_parameter_count_; }
2339
2340 bool IsApplyFunction() const {
2341 return function_->code() ==
2342 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply);
2343 }
2344
2345 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2346
2347 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2348 return Representation::None();
2349 }
2350
2351 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE {
2352 return has_stack_check_;
2353 }
2354
2355 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction)
2356
2357 private:
2358 HCallConstantFunction(Handle<JSFunction> function, int argument_count)
2359 : HCall<0>(argument_count),
2360 function_(function),
2361 formal_parameter_count_(function->shared()->formal_parameter_count()),
2362 has_stack_check_(
2363 function->code()->kind() == Code::FUNCTION ||
2364 function->code()->kind() == Code::OPTIMIZED_FUNCTION) {}
2365
2366 Handle<JSFunction> function_;
2367 int formal_parameter_count_;
2368 bool has_stack_check_;
2369 };
2370
2371
2372 class HCallKeyed V8_FINAL : public HBinaryCall {
2373 public:
2374 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int);
2375
2376 HValue* context() { return first(); }
2377 HValue* key() { return second(); }
2378
2379 DECLARE_CONCRETE_INSTRUCTION(CallKeyed)
2380
2381 private:
2382 HCallKeyed(HValue* context, HValue* key, int argument_count)
2383 : HBinaryCall(context, key, argument_count) {
2384 }
2385 };
2386
2387
2388 class HCallNamed V8_FINAL : public HUnaryCall {
2389 public:
2390 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int);
2391
2392 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2393
2394 HValue* context() { return value(); }
2395 Handle<String> name() const { return name_; }
2396
2397 DECLARE_CONCRETE_INSTRUCTION(CallNamed)
2398
2399 private:
2400 HCallNamed(HValue* context, Handle<String> name, int argument_count)
2401 : HUnaryCall(context, argument_count), name_(name) {
2402 }
2403
2404 Handle<String> name_;
2405 };
2406
2407
2408 enum CallMode { 2462 enum CallMode {
2409 NORMAL_CALL, 2463 NORMAL_CALL,
2410 TAIL_CALL, 2464 TAIL_CALL,
2411 NORMAL_CONTEXTUAL_CALL 2465 NORMAL_CONTEXTUAL_CALL
2412 }; 2466 };
2413 2467
2414 2468
2415 class HCallFunction V8_FINAL : public HBinaryCall { 2469 class HCallFunction V8_FINAL : public HBinaryCall {
2416 public: 2470 public:
2417 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); 2471 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int);
(...skipping 16 matching lines...) Expand all
2434 HCallFunction(HValue* context, 2488 HCallFunction(HValue* context,
2435 HValue* function, 2489 HValue* function,
2436 int argument_count, 2490 int argument_count,
2437 CallMode mode = NORMAL_CALL) 2491 CallMode mode = NORMAL_CALL)
2438 : HBinaryCall(context, function, argument_count), call_mode_(mode) { 2492 : HBinaryCall(context, function, argument_count), call_mode_(mode) {
2439 } 2493 }
2440 CallMode call_mode_; 2494 CallMode call_mode_;
2441 }; 2495 };
2442 2496
2443 2497
2444 class HCallKnownGlobal V8_FINAL : public HCall<0> {
2445 public:
2446 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int);
2447
2448 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2449
2450 Handle<JSFunction> target() const { return target_; }
2451 int formal_parameter_count() const { return formal_parameter_count_; }
2452
2453 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2454 return Representation::None();
2455 }
2456
2457 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE {
2458 return has_stack_check_;
2459 }
2460
2461 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal)
2462
2463 private:
2464 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
2465 : HCall<0>(argument_count),
2466 target_(target),
2467 formal_parameter_count_(target->shared()->formal_parameter_count()),
2468 has_stack_check_(
2469 target->code()->kind() == Code::FUNCTION ||
2470 target->code()->kind() == Code::OPTIMIZED_FUNCTION) {}
2471
2472 Handle<JSFunction> target_;
2473 int formal_parameter_count_;
2474 bool has_stack_check_;
2475 };
2476
2477
2478 class HCallNew V8_FINAL : public HBinaryCall { 2498 class HCallNew V8_FINAL : public HBinaryCall {
2479 public: 2499 public:
2480 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); 2500 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int);
2481 2501
2482 HValue* context() { return first(); } 2502 HValue* context() { return first(); }
2483 HValue* constructor() { return second(); } 2503 HValue* constructor() { return second(); }
2484 2504
2485 DECLARE_CONCRETE_INSTRUCTION(CallNew) 2505 DECLARE_CONCRETE_INSTRUCTION(CallNew)
2486 2506
2487 private: 2507 private:
(...skipping 5070 matching lines...) Expand 10 before | Expand all | Expand 10 after
7558 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7578 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7559 }; 7579 };
7560 7580
7561 7581
7562 #undef DECLARE_INSTRUCTION 7582 #undef DECLARE_INSTRUCTION
7563 #undef DECLARE_CONCRETE_INSTRUCTION 7583 #undef DECLARE_CONCRETE_INSTRUCTION
7564 7584
7565 } } // namespace v8::internal 7585 } } // namespace v8::internal
7566 7586
7567 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7587 #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