Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(CallGlobal) \ | 83 V(CallGlobal) \ |
| 83 V(CallKeyed) \ | |
| 84 V(CallKnownGlobal) \ | |
| 85 V(CallNamed) \ | |
| 86 V(CallNew) \ | 84 V(CallNew) \ |
| 87 V(CallNewArray) \ | 85 V(CallNewArray) \ |
| 88 V(CallRuntime) \ | 86 V(CallRuntime) \ |
| 89 V(CallStub) \ | 87 V(CallStub) \ |
| 90 V(CapturedObject) \ | 88 V(CapturedObject) \ |
| 91 V(Change) \ | 89 V(Change) \ |
| 92 V(CheckHeapObject) \ | 90 V(CheckHeapObject) \ |
| 93 V(CheckInstanceType) \ | 91 V(CheckInstanceType) \ |
| 94 V(CheckMaps) \ | 92 V(CheckMaps) \ |
| 95 V(CheckMapValue) \ | 93 V(CheckMapValue) \ |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2281 virtual Representation RequiredInputRepresentation( | 2279 virtual Representation RequiredInputRepresentation( |
| 2282 int index) V8_FINAL V8_OVERRIDE { | 2280 int index) V8_FINAL V8_OVERRIDE { |
| 2283 return Representation::Tagged(); | 2281 return Representation::Tagged(); |
| 2284 } | 2282 } |
| 2285 | 2283 |
| 2286 HValue* first() { return OperandAt(0); } | 2284 HValue* first() { return OperandAt(0); } |
| 2287 HValue* second() { return OperandAt(1); } | 2285 HValue* second() { return OperandAt(1); } |
| 2288 }; | 2286 }; |
| 2289 | 2287 |
| 2290 | 2288 |
| 2289 class HCallJSFunction V8_FINAL : public HCall<2> { | |
| 2290 public: | |
| 2291 static HCallJSFunction* New(Zone* zone, | |
| 2292 HValue* context, | |
| 2293 HValue* function, | |
| 2294 HValue* call_kind_value, | |
| 2295 int argument_count, | |
| 2296 bool pass_argument_count) { | |
| 2297 return new(zone) HCallJSFunction(function, call_kind_value, | |
|
Toon Verwaest
2013/12/18 16:11:41
nit:
return new(zone) HCallJSFunction(
functio
Jarin
2013/12/30 15:15:47
Done.
| |
| 2298 argument_count, pass_argument_count); | |
| 2299 } | |
| 2300 | |
| 2301 HValue* function() { return OperandAt(0); } | |
| 2302 HValue* call_kind() { return OperandAt(1); } | |
| 2303 | |
| 2304 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2305 | |
| 2306 virtual Representation RequiredInputRepresentation( | |
| 2307 int index) V8_FINAL V8_OVERRIDE { | |
| 2308 if (index == 0) { | |
| 2309 return Representation::Tagged(); | |
| 2310 } else if (index == 1) { | |
|
Toon Verwaest
2013/12/18 16:11:41
What about just
if (index == 0) return Representa
Jarin
2013/12/30 15:15:47
I quite like to list the options for index explici
| |
| 2311 return Representation::Smi(); | |
| 2312 } | |
| 2313 UNREACHABLE(); | |
| 2314 return Representation::None(); | |
| 2315 } | |
| 2316 | |
| 2317 bool pass_argument_count() const { return pass_argument_count_; } | |
| 2318 | |
| 2319 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) | |
| 2320 | |
| 2321 private: | |
| 2322 // The argument count includes the receiver. | |
| 2323 HCallJSFunction(HValue* function, HValue* call_kind, int argument_count, | |
|
Toon Verwaest
2013/12/18 16:11:41
Arguments of function declarations on separate lin
Jarin
2013/12/30 15:15:47
Done.
| |
| 2324 bool pass_argument_count) | |
| 2325 : HCall<2>(argument_count), | |
|
Toon Verwaest
2013/12/18 16:11:41
You can put these on a single line if they fit.
Jarin
2013/12/30 15:15:47
They do not fit (esp. after the rebase change I ha
| |
| 2326 pass_argument_count_(pass_argument_count) { | |
| 2327 SetOperandAt(0, function); | |
| 2328 SetOperandAt(1, call_kind); | |
| 2329 } | |
| 2330 | |
| 2331 bool pass_argument_count_; | |
| 2332 }; | |
| 2333 | |
| 2334 | |
| 2335 class HCallWithDescriptor V8_FINAL : public HInstruction { | |
| 2336 public: | |
| 2337 static HCallWithDescriptor* New(Zone* zone, HValue* context, | |
| 2338 HValue* target, | |
| 2339 int argument_count, | |
| 2340 const CodeStubInterfaceDescriptor* descriptor, | |
| 2341 Vector<HValue*>& operands) { | |
| 2342 ASSERT(operands.length() == descriptor->environment_length()); | |
| 2343 HCallWithDescriptor* res = | |
| 2344 new(zone) HCallWithDescriptor(target, argument_count, | |
| 2345 descriptor, operands, zone); | |
| 2346 return res; | |
| 2347 } | |
| 2348 | |
| 2349 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } | |
| 2350 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { | |
| 2351 return values_[index]; | |
| 2352 } | |
| 2353 | |
| 2354 virtual Representation RequiredInputRepresentation( | |
| 2355 int index) V8_FINAL V8_OVERRIDE { | |
| 2356 if (index == 0) { | |
| 2357 return Representation::Tagged(); | |
| 2358 } else { | |
| 2359 int par_index = index - 1; | |
| 2360 if (par_index < descriptor_->environment_length()) { | |
|
Toon Verwaest
2013/12/18 16:11:41
Why not just ASSERT(par_index < descriptor_->envir
Jarin
2013/12/30 15:15:47
Done.
| |
| 2361 return descriptor_->GetParameterRepresentation(par_index); | |
| 2362 } | |
| 2363 UNREACHABLE(); | |
| 2364 return Representation::None(); | |
| 2365 } | |
| 2366 } | |
| 2367 | |
| 2368 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) | |
| 2369 | |
| 2370 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { | |
| 2371 return HType::Tagged(); | |
| 2372 } | |
| 2373 | |
| 2374 virtual int argument_count() const { | |
| 2375 return argument_count_; | |
| 2376 } | |
| 2377 | |
| 2378 virtual int argument_delta() const V8_OVERRIDE { | |
| 2379 return -argument_count_; | |
| 2380 } | |
| 2381 | |
| 2382 const CodeStubInterfaceDescriptor* descriptor() const { | |
| 2383 return descriptor_; | |
| 2384 } | |
| 2385 | |
| 2386 HValue* target() { | |
| 2387 return OperandAt(0); | |
| 2388 } | |
| 2389 | |
| 2390 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } | |
| 2391 | |
| 2392 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2393 | |
| 2394 private: | |
| 2395 // The argument count includes the receiver. | |
| 2396 HCallWithDescriptor(HValue* target, | |
| 2397 int argument_count, | |
| 2398 const CodeStubInterfaceDescriptor* descriptor, | |
| 2399 Vector<HValue*>& operands, | |
| 2400 Zone* zone) | |
| 2401 : descriptor_(descriptor), | |
| 2402 values_(descriptor->environment_length() + 1, zone) { | |
| 2403 argument_count_ = argument_count; | |
| 2404 AddOperand(target, zone); | |
| 2405 for (int i = 0; i < operands.length(); i++) { | |
| 2406 AddOperand(operands[i], zone); | |
| 2407 } | |
| 2408 this->set_representation(Representation::Tagged()); | |
| 2409 this->SetAllSideEffects(); | |
| 2410 } | |
| 2411 | |
| 2412 void AddOperand(HValue* v, Zone* zone) { | |
| 2413 values_.Add(NULL, zone); | |
| 2414 SetOperandAt(values_.length() - 1, v); | |
| 2415 } | |
| 2416 | |
| 2417 void InternalSetOperandAt(int index, | |
| 2418 HValue* value) V8_FINAL V8_OVERRIDE { | |
| 2419 values_[index] = value; | |
| 2420 } | |
| 2421 | |
| 2422 const CodeStubInterfaceDescriptor* descriptor_; | |
| 2423 ZoneList<HValue*> values_; | |
| 2424 int argument_count_; | |
| 2425 }; | |
| 2426 | |
| 2427 | |
| 2291 class HInvokeFunction V8_FINAL : public HBinaryCall { | 2428 class HInvokeFunction V8_FINAL : public HBinaryCall { |
| 2292 public: | 2429 public: |
| 2293 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2430 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
| 2294 | 2431 |
| 2295 HInvokeFunction(HValue* context, | 2432 HInvokeFunction(HValue* context, |
| 2296 HValue* function, | 2433 HValue* function, |
| 2297 Handle<JSFunction> known_function, | 2434 Handle<JSFunction> known_function, |
| 2298 int argument_count) | 2435 int argument_count) |
| 2299 : HBinaryCall(context, function, argument_count), | 2436 : HBinaryCall(context, function, argument_count), |
| 2300 known_function_(known_function) { | 2437 known_function_(known_function) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2321 private: | 2458 private: |
| 2322 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2459 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
| 2323 : HBinaryCall(context, function, argument_count) { | 2460 : HBinaryCall(context, function, argument_count) { |
| 2324 } | 2461 } |
| 2325 | 2462 |
| 2326 Handle<JSFunction> known_function_; | 2463 Handle<JSFunction> known_function_; |
| 2327 int formal_parameter_count_; | 2464 int formal_parameter_count_; |
| 2328 }; | 2465 }; |
| 2329 | 2466 |
| 2330 | 2467 |
| 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 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | |
| 2352 | |
| 2353 private: | |
| 2354 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | |
| 2355 : HCall<0>(argument_count), | |
| 2356 function_(function), | |
| 2357 formal_parameter_count_(function->shared()->formal_parameter_count()) {} | |
| 2358 | |
| 2359 Handle<JSFunction> function_; | |
| 2360 int formal_parameter_count_; | |
| 2361 }; | |
| 2362 | |
| 2363 | |
| 2364 class HCallKeyed V8_FINAL : public HBinaryCall { | |
| 2365 public: | |
| 2366 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); | |
| 2367 | |
| 2368 HValue* context() { return first(); } | |
| 2369 HValue* key() { return second(); } | |
| 2370 | |
| 2371 DECLARE_CONCRETE_INSTRUCTION(CallKeyed) | |
| 2372 | |
| 2373 private: | |
| 2374 HCallKeyed(HValue* context, HValue* key, int argument_count) | |
| 2375 : HBinaryCall(context, key, argument_count) { | |
| 2376 } | |
| 2377 }; | |
| 2378 | |
| 2379 | |
| 2380 class HCallNamed V8_FINAL : public HUnaryCall { | |
| 2381 public: | |
| 2382 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNamed, Handle<String>, int); | |
| 2383 | |
| 2384 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2385 | |
| 2386 HValue* context() { return value(); } | |
| 2387 Handle<String> name() const { return name_; } | |
| 2388 | |
| 2389 DECLARE_CONCRETE_INSTRUCTION(CallNamed) | |
| 2390 | |
| 2391 private: | |
| 2392 HCallNamed(HValue* context, Handle<String> name, int argument_count) | |
| 2393 : HUnaryCall(context, argument_count), name_(name) { | |
| 2394 } | |
| 2395 | |
| 2396 Handle<String> name_; | |
| 2397 }; | |
| 2398 | |
| 2399 | |
| 2400 enum CallMode { | 2468 enum CallMode { |
| 2401 NORMAL_CALL, | 2469 NORMAL_CALL, |
| 2402 TAIL_CALL | 2470 TAIL_CALL |
| 2403 }; | 2471 }; |
| 2404 | 2472 |
| 2405 | 2473 |
| 2406 class HCallFunction V8_FINAL : public HBinaryCall { | 2474 class HCallFunction V8_FINAL : public HBinaryCall { |
| 2407 public: | 2475 public: |
| 2408 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2476 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
| 2409 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( | 2477 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2445 | 2513 |
| 2446 private: | 2514 private: |
| 2447 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 2515 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
| 2448 : HUnaryCall(context, argument_count), name_(name) { | 2516 : HUnaryCall(context, argument_count), name_(name) { |
| 2449 } | 2517 } |
| 2450 | 2518 |
| 2451 Handle<String> name_; | 2519 Handle<String> name_; |
| 2452 }; | 2520 }; |
| 2453 | 2521 |
| 2454 | 2522 |
| 2455 class HCallKnownGlobal V8_FINAL : public HCall<0> { | |
| 2456 public: | |
| 2457 DECLARE_INSTRUCTION_FACTORY_P2(HCallKnownGlobal, Handle<JSFunction>, int); | |
| 2458 | |
| 2459 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | |
| 2460 | |
| 2461 Handle<JSFunction> target() const { return target_; } | |
| 2462 int formal_parameter_count() const { return formal_parameter_count_; } | |
| 2463 | |
| 2464 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 2465 return Representation::None(); | |
| 2466 } | |
| 2467 | |
| 2468 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | |
| 2469 | |
| 2470 private: | |
| 2471 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | |
| 2472 : HCall<0>(argument_count), | |
| 2473 target_(target), | |
| 2474 formal_parameter_count_(target->shared()->formal_parameter_count()) { } | |
| 2475 | |
| 2476 Handle<JSFunction> target_; | |
| 2477 int formal_parameter_count_; | |
| 2478 }; | |
| 2479 | |
| 2480 | |
| 2481 class HCallNew V8_FINAL : public HBinaryCall { | 2523 class HCallNew V8_FINAL : public HBinaryCall { |
| 2482 public: | 2524 public: |
| 2483 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); | 2525 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |
| 2484 | 2526 |
| 2485 HValue* context() { return first(); } | 2527 HValue* context() { return first(); } |
| 2486 HValue* constructor() { return second(); } | 2528 HValue* constructor() { return second(); } |
| 2487 | 2529 |
| 2488 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2530 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
| 2489 | 2531 |
| 2490 private: | 2532 private: |
| (...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7489 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7531 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7490 }; | 7532 }; |
| 7491 | 7533 |
| 7492 | 7534 |
| 7493 #undef DECLARE_INSTRUCTION | 7535 #undef DECLARE_INSTRUCTION |
| 7494 #undef DECLARE_CONCRETE_INSTRUCTION | 7536 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7495 | 7537 |
| 7496 } } // namespace v8::internal | 7538 } } // namespace v8::internal |
| 7497 | 7539 |
| 7498 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7540 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |