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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } | 1238 } |
1239 | 1239 |
1240 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1240 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
1241 | 1241 |
1242 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1242 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
1243 | 1243 |
1244 #ifdef DEBUG | 1244 #ifdef DEBUG |
1245 virtual void Verify() V8_OVERRIDE; | 1245 virtual void Verify() V8_OVERRIDE; |
1246 #endif | 1246 #endif |
1247 | 1247 |
1248 virtual bool IsCall() { return false; } | 1248 virtual bool HasStackCheck() { return false; } |
1249 | 1249 |
1250 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1250 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
1251 | 1251 |
1252 protected: | 1252 protected: |
1253 HInstruction(HType type = HType::Tagged()) | 1253 HInstruction(HType type = HType::Tagged()) |
1254 : HValue(type), | 1254 : HValue(type), |
1255 next_(NULL), | 1255 next_(NULL), |
1256 previous_(NULL), | 1256 previous_(NULL), |
1257 position_(RelocInfo::kNoPosition) { | 1257 position_(RelocInfo::kNoPosition) { |
1258 SetGVNFlag(kDependsOnOsrEntries); | 1258 SetGVNFlag(kDependsOnOsrEntries); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 } | 2236 } |
2237 | 2237 |
2238 virtual int argument_count() const { | 2238 virtual int argument_count() const { |
2239 return argument_count_; | 2239 return argument_count_; |
2240 } | 2240 } |
2241 | 2241 |
2242 virtual int argument_delta() const V8_OVERRIDE { | 2242 virtual int argument_delta() const V8_OVERRIDE { |
2243 return -argument_count(); | 2243 return -argument_count(); |
2244 } | 2244 } |
2245 | 2245 |
2246 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } | |
2247 | |
2248 private: | 2246 private: |
2249 int argument_count_; | 2247 int argument_count_; |
2250 }; | 2248 }; |
2251 | 2249 |
2252 | 2250 |
2253 class HUnaryCall : public HCall<1> { | 2251 class HUnaryCall : public HCall<1> { |
2254 public: | 2252 public: |
2255 HUnaryCall(HValue* value, int argument_count) | 2253 HUnaryCall(HValue* value, int argument_count) |
2256 : HCall<1>(argument_count) { | 2254 : HCall<1>(argument_count) { |
2257 SetOperandAt(0, value); | 2255 SetOperandAt(0, value); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2293 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2291 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
2294 | 2292 |
2295 HInvokeFunction(HValue* context, | 2293 HInvokeFunction(HValue* context, |
2296 HValue* function, | 2294 HValue* function, |
2297 Handle<JSFunction> known_function, | 2295 Handle<JSFunction> known_function, |
2298 int argument_count) | 2296 int argument_count) |
2299 : HBinaryCall(context, function, argument_count), | 2297 : HBinaryCall(context, function, argument_count), |
2300 known_function_(known_function) { | 2298 known_function_(known_function) { |
2301 formal_parameter_count_ = known_function.is_null() | 2299 formal_parameter_count_ = known_function.is_null() |
2302 ? 0 : known_function->shared()->formal_parameter_count(); | 2300 ? 0 : known_function->shared()->formal_parameter_count(); |
| 2301 has_stack_check_ = !known_function.is_null() && |
| 2302 (known_function->code()->kind() == Code::FUNCTION || |
| 2303 known_function->code()->kind() == Code::OPTIMIZED_FUNCTION); |
2303 } | 2304 } |
2304 | 2305 |
2305 static HInvokeFunction* New(Zone* zone, | 2306 static HInvokeFunction* New(Zone* zone, |
2306 HValue* context, | 2307 HValue* context, |
2307 HValue* function, | 2308 HValue* function, |
2308 Handle<JSFunction> known_function, | 2309 Handle<JSFunction> known_function, |
2309 int argument_count) { | 2310 int argument_count) { |
2310 return new(zone) HInvokeFunction(context, function, | 2311 return new(zone) HInvokeFunction(context, function, |
2311 known_function, argument_count); | 2312 known_function, argument_count); |
2312 } | 2313 } |
2313 | 2314 |
2314 HValue* context() { return first(); } | 2315 HValue* context() { return first(); } |
2315 HValue* function() { return second(); } | 2316 HValue* function() { return second(); } |
2316 Handle<JSFunction> known_function() { return known_function_; } | 2317 Handle<JSFunction> known_function() { return known_function_; } |
2317 int formal_parameter_count() const { return formal_parameter_count_; } | 2318 int formal_parameter_count() const { return formal_parameter_count_; } |
2318 | 2319 |
| 2320 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
| 2321 return has_stack_check_; |
| 2322 } |
| 2323 |
2319 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 2324 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
2320 | 2325 |
2321 private: | 2326 private: |
2322 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2327 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
2323 : HBinaryCall(context, function, argument_count) { | 2328 : HBinaryCall(context, function, argument_count), |
| 2329 has_stack_check_(false) { |
2324 } | 2330 } |
2325 | 2331 |
2326 Handle<JSFunction> known_function_; | 2332 Handle<JSFunction> known_function_; |
2327 int formal_parameter_count_; | 2333 int formal_parameter_count_; |
| 2334 bool has_stack_check_; |
2328 }; | 2335 }; |
2329 | 2336 |
2330 | 2337 |
2331 class HCallConstantFunction V8_FINAL : public HCall<0> { | 2338 class HCallConstantFunction V8_FINAL : public HCall<0> { |
2332 public: | 2339 public: |
2333 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction, | 2340 DECLARE_INSTRUCTION_FACTORY_P2(HCallConstantFunction, |
2334 Handle<JSFunction>, | 2341 Handle<JSFunction>, |
2335 int); | 2342 int); |
2336 | 2343 |
2337 Handle<JSFunction> function() const { return function_; } | 2344 Handle<JSFunction> function() const { return function_; } |
2338 int formal_parameter_count() const { return formal_parameter_count_; } | 2345 int formal_parameter_count() const { return formal_parameter_count_; } |
2339 | 2346 |
2340 bool IsApplyFunction() const { | 2347 bool IsApplyFunction() const { |
2341 return function_->code() == | 2348 return function_->code() == |
2342 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); | 2349 function_->GetIsolate()->builtins()->builtin(Builtins::kFunctionApply); |
2343 } | 2350 } |
2344 | 2351 |
2345 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2352 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
2346 | 2353 |
2347 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2354 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
2348 return Representation::None(); | 2355 return Representation::None(); |
2349 } | 2356 } |
2350 | 2357 |
| 2358 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
| 2359 return has_stack_check_; |
| 2360 } |
| 2361 |
2351 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) | 2362 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction) |
2352 | 2363 |
2353 private: | 2364 private: |
2354 HCallConstantFunction(Handle<JSFunction> function, int argument_count) | 2365 HCallConstantFunction(Handle<JSFunction> function, int argument_count) |
2355 : HCall<0>(argument_count), | 2366 : HCall<0>(argument_count), |
2356 function_(function), | 2367 function_(function), |
2357 formal_parameter_count_(function->shared()->formal_parameter_count()) {} | 2368 formal_parameter_count_(function->shared()->formal_parameter_count()), |
| 2369 has_stack_check_( |
| 2370 function->code()->kind() == Code::FUNCTION || |
| 2371 function->code()->kind() == Code::OPTIMIZED_FUNCTION) {} |
2358 | 2372 |
2359 Handle<JSFunction> function_; | 2373 Handle<JSFunction> function_; |
2360 int formal_parameter_count_; | 2374 int formal_parameter_count_; |
| 2375 bool has_stack_check_; |
2361 }; | 2376 }; |
2362 | 2377 |
2363 | 2378 |
2364 class HCallKeyed V8_FINAL : public HBinaryCall { | 2379 class HCallKeyed V8_FINAL : public HBinaryCall { |
2365 public: | 2380 public: |
2366 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); | 2381 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallKeyed, HValue*, int); |
2367 | 2382 |
2368 HValue* context() { return first(); } | 2383 HValue* context() { return first(); } |
2369 HValue* key() { return second(); } | 2384 HValue* key() { return second(); } |
2370 | 2385 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 | 2473 |
2459 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2474 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
2460 | 2475 |
2461 Handle<JSFunction> target() const { return target_; } | 2476 Handle<JSFunction> target() const { return target_; } |
2462 int formal_parameter_count() const { return formal_parameter_count_; } | 2477 int formal_parameter_count() const { return formal_parameter_count_; } |
2463 | 2478 |
2464 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2479 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
2465 return Representation::None(); | 2480 return Representation::None(); |
2466 } | 2481 } |
2467 | 2482 |
| 2483 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { |
| 2484 return has_stack_check_; |
| 2485 } |
| 2486 |
2468 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) | 2487 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal) |
2469 | 2488 |
2470 private: | 2489 private: |
2471 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) | 2490 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) |
2472 : HCall<0>(argument_count), | 2491 : HCall<0>(argument_count), |
2473 target_(target), | 2492 target_(target), |
2474 formal_parameter_count_(target->shared()->formal_parameter_count()) { } | 2493 formal_parameter_count_(target->shared()->formal_parameter_count()), |
| 2494 has_stack_check_( |
| 2495 target->code()->kind() == Code::FUNCTION || |
| 2496 target->code()->kind() == Code::OPTIMIZED_FUNCTION) {} |
2475 | 2497 |
2476 Handle<JSFunction> target_; | 2498 Handle<JSFunction> target_; |
2477 int formal_parameter_count_; | 2499 int formal_parameter_count_; |
| 2500 bool has_stack_check_; |
2478 }; | 2501 }; |
2479 | 2502 |
2480 | 2503 |
2481 class HCallNew V8_FINAL : public HBinaryCall { | 2504 class HCallNew V8_FINAL : public HBinaryCall { |
2482 public: | 2505 public: |
2483 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); | 2506 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |
2484 | 2507 |
2485 HValue* context() { return first(); } | 2508 HValue* context() { return first(); } |
2486 HValue* constructor() { return second(); } | 2509 HValue* constructor() { return second(); } |
2487 | 2510 |
(...skipping 5028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7516 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7539 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
7517 }; | 7540 }; |
7518 | 7541 |
7519 | 7542 |
7520 #undef DECLARE_INSTRUCTION | 7543 #undef DECLARE_INSTRUCTION |
7521 #undef DECLARE_CONCRETE_INSTRUCTION | 7544 #undef DECLARE_CONCRETE_INSTRUCTION |
7522 | 7545 |
7523 } } // namespace v8::internal | 7546 } } // namespace v8::internal |
7524 | 7547 |
7525 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7548 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |