OLD | NEW |
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_FULL_CODEGEN_H_ | 5 #ifndef V8_FULL_CODEGEN_H_ |
6 #define V8_FULL_CODEGEN_H_ | 6 #define V8_FULL_CODEGEN_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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 : NestedStatement(codegen) { | 284 : NestedStatement(codegen) { |
285 } | 285 } |
286 virtual ~WithOrCatch() {} | 286 virtual ~WithOrCatch() {} |
287 | 287 |
288 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { | 288 virtual NestedStatement* Exit(int* stack_depth, int* context_length) { |
289 ++(*context_length); | 289 ++(*context_length); |
290 return previous_; | 290 return previous_; |
291 } | 291 } |
292 }; | 292 }; |
293 | 293 |
294 // Type of a member function that generates inline code for a native function. | |
295 typedef void (FullCodeGenerator::*InlineFunctionGenerator)(CallRuntime* expr); | |
296 | |
297 static const InlineFunctionGenerator kInlineFunctionGenerators[]; | |
298 | |
299 // A platform-specific utility to overwrite the accumulator register | 294 // A platform-specific utility to overwrite the accumulator register |
300 // with a GC-safe value. | 295 // with a GC-safe value. |
301 void ClearAccumulator(); | 296 void ClearAccumulator(); |
302 | 297 |
303 // Determine whether or not to inline the smi case for the given | 298 // Determine whether or not to inline the smi case for the given |
304 // operation. | 299 // operation. |
305 bool ShouldInlineSmiCase(Token::Value op); | 300 bool ShouldInlineSmiCase(Token::Value op); |
306 | 301 |
307 // Helper function to convert a pure value into a test context. The value | 302 // Helper function to convert a pure value into a test context. The value |
308 // is expected on the stack or the accumulator, depending on the platform. | 303 // is expected on the stack or the accumulator, depending on the platform. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 void EmitReturnSequence(); | 483 void EmitReturnSequence(); |
489 | 484 |
490 // Platform-specific code sequences for calls | 485 // Platform-specific code sequences for calls |
491 void EmitCall(Call* expr, CallICState::CallType = CallICState::FUNCTION); | 486 void EmitCall(Call* expr, CallICState::CallType = CallICState::FUNCTION); |
492 void EmitSuperConstructorCall(Call* expr); | 487 void EmitSuperConstructorCall(Call* expr); |
493 void EmitCallWithLoadIC(Call* expr); | 488 void EmitCallWithLoadIC(Call* expr); |
494 void EmitSuperCallWithLoadIC(Call* expr); | 489 void EmitSuperCallWithLoadIC(Call* expr); |
495 void EmitKeyedCallWithLoadIC(Call* expr, Expression* key); | 490 void EmitKeyedCallWithLoadIC(Call* expr, Expression* key); |
496 void EmitKeyedSuperCallWithLoadIC(Call* expr); | 491 void EmitKeyedSuperCallWithLoadIC(Call* expr); |
497 | 492 |
498 // Platform-specific code for inline runtime calls. | 493 #define FOR_EACH_FULL_CODE_INTRINSIC(F) \ |
499 InlineFunctionGenerator FindInlineFunctionGenerator(CallRuntime* expr); | 494 F(IsSmi) \ |
| 495 F(IsNonNegativeSmi) \ |
| 496 F(IsArray) \ |
| 497 F(IsRegExp) \ |
| 498 F(IsJSProxy) \ |
| 499 F(IsConstructCall) \ |
| 500 F(CallFunction) \ |
| 501 F(DefaultConstructorCallSuper) \ |
| 502 F(ArgumentsLength) \ |
| 503 F(Arguments) \ |
| 504 F(ValueOf) \ |
| 505 F(SetValueOf) \ |
| 506 F(DateField) \ |
| 507 F(StringCharFromCode) \ |
| 508 F(StringCharAt) \ |
| 509 F(OneByteSeqStringSetChar) \ |
| 510 F(TwoByteSeqStringSetChar) \ |
| 511 F(ObjectEquals) \ |
| 512 F(IsObject) \ |
| 513 F(IsFunction) \ |
| 514 F(IsUndetectableObject) \ |
| 515 F(IsSpecObject) \ |
| 516 F(IsStringWrapperSafeForDefaultValueOf) \ |
| 517 F(MathPow) \ |
| 518 F(IsMinusZero) \ |
| 519 F(HasCachedArrayIndex) \ |
| 520 F(GetCachedArrayIndex) \ |
| 521 F(FastOneByteArrayJoin) \ |
| 522 F(GeneratorNext) \ |
| 523 F(GeneratorThrow) \ |
| 524 F(DebugBreakInOptimizedCode) \ |
| 525 F(ClassOf) \ |
| 526 F(StringCharCodeAt) \ |
| 527 F(StringAdd) \ |
| 528 F(SubString) \ |
| 529 F(StringCompare) \ |
| 530 F(RegExpExec) \ |
| 531 F(RegExpConstructResult) \ |
| 532 F(GetFromCache) \ |
| 533 F(NumberToString) \ |
| 534 F(DebugIsActive) |
500 | 535 |
501 void EmitInlineRuntimeCall(CallRuntime* expr, | 536 #define GENERATOR_DECLARATION(Name) void Emit##Name(CallRuntime* call); |
502 InlineFunctionGenerator generator); | 537 FOR_EACH_FULL_CODE_INTRINSIC(GENERATOR_DECLARATION) |
503 | 538 #undef GENERATOR_DECLARATION |
504 #define EMIT_INLINE_RUNTIME_CALL(name, x, y) \ | |
505 void Emit##name(CallRuntime* expr); | |
506 INLINE_FUNCTION_LIST(EMIT_INLINE_RUNTIME_CALL) | |
507 #undef EMIT_INLINE_RUNTIME_CALL | |
508 | 539 |
509 // Platform-specific code for resuming generators. | 540 // Platform-specific code for resuming generators. |
510 void EmitGeneratorResume(Expression *generator, | 541 void EmitGeneratorResume(Expression *generator, |
511 Expression *value, | 542 Expression *value, |
512 JSGeneratorObject::ResumeMode resume_mode); | 543 JSGeneratorObject::ResumeMode resume_mode); |
513 | 544 |
514 // Platform-specific code for loading variables. | 545 // Platform-specific code for loading variables. |
515 void EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 546 void EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
516 TypeofState typeof_state, | 547 TypeofState typeof_state, |
517 Label* slow); | 548 Label* slow); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 | 1060 |
1030 Address start_; | 1061 Address start_; |
1031 Address instruction_start_; | 1062 Address instruction_start_; |
1032 uint32_t length_; | 1063 uint32_t length_; |
1033 }; | 1064 }; |
1034 | 1065 |
1035 | 1066 |
1036 } } // namespace v8::internal | 1067 } } // namespace v8::internal |
1037 | 1068 |
1038 #endif // V8_FULL_CODEGEN_H_ | 1069 #endif // V8_FULL_CODEGEN_H_ |
OLD | NEW |