OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 RegisterAllocator* allocator() const { return allocator_; } | 332 RegisterAllocator* allocator() const { return allocator_; } |
333 | 333 |
334 CodeGenState* state() { return state_; } | 334 CodeGenState* state() { return state_; } |
335 void set_state(CodeGenState* state) { state_ = state; } | 335 void set_state(CodeGenState* state) { state_ = state; } |
336 | 336 |
337 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 337 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
338 | 338 |
339 bool in_spilled_code() const { return in_spilled_code_; } | 339 bool in_spilled_code() const { return in_spilled_code_; } |
340 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } | 340 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } |
341 | 341 |
| 342 // If the name is an inline runtime function call return the number of |
| 343 // expected arguments. Otherwise return -1. |
| 344 static int InlineRuntimeCallArgumentsCount(Handle<String> name); |
| 345 |
342 private: | 346 private: |
343 // Construction/Destruction | 347 // Construction/Destruction |
344 explicit CodeGenerator(MacroAssembler* masm); | 348 explicit CodeGenerator(MacroAssembler* masm); |
345 | 349 |
346 // Accessors | 350 // Accessors |
347 inline bool is_eval(); | 351 inline bool is_eval(); |
348 inline Scope* scope(); | 352 inline Scope* scope(); |
349 | 353 |
350 // Generating deferred code. | 354 // Generating deferred code. |
351 void ProcessDeferred(); | 355 void ProcessDeferred(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 void CallApplyLazy(Expression* applicand, | 519 void CallApplyLazy(Expression* applicand, |
516 Expression* receiver, | 520 Expression* receiver, |
517 VariableProxy* arguments, | 521 VariableProxy* arguments, |
518 int position); | 522 int position); |
519 | 523 |
520 void CheckStack(); | 524 void CheckStack(); |
521 | 525 |
522 struct InlineRuntimeLUT { | 526 struct InlineRuntimeLUT { |
523 void (CodeGenerator::*method)(ZoneList<Expression*>*); | 527 void (CodeGenerator::*method)(ZoneList<Expression*>*); |
524 const char* name; | 528 const char* name; |
| 529 int nargs; |
525 }; | 530 }; |
526 | 531 |
527 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | 532 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); |
528 bool CheckForInlineRuntimeCall(CallRuntime* node); | 533 bool CheckForInlineRuntimeCall(CallRuntime* node); |
529 static bool PatchInlineRuntimeEntry(Handle<String> name, | 534 static bool PatchInlineRuntimeEntry(Handle<String> name, |
530 const InlineRuntimeLUT& new_entry, | 535 const InlineRuntimeLUT& new_entry, |
531 InlineRuntimeLUT* old_entry); | 536 InlineRuntimeLUT* old_entry); |
532 | 537 |
533 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 538 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
534 | 539 |
(...skipping 13 matching lines...) Expand all Loading... |
548 void GenerateIsRegExp(ZoneList<Expression*>* args); | 553 void GenerateIsRegExp(ZoneList<Expression*>* args); |
549 void GenerateIsObject(ZoneList<Expression*>* args); | 554 void GenerateIsObject(ZoneList<Expression*>* args); |
550 void GenerateIsFunction(ZoneList<Expression*>* args); | 555 void GenerateIsFunction(ZoneList<Expression*>* args); |
551 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); | 556 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); |
552 | 557 |
553 // Support for construct call checks. | 558 // Support for construct call checks. |
554 void GenerateIsConstructCall(ZoneList<Expression*>* args); | 559 void GenerateIsConstructCall(ZoneList<Expression*>* args); |
555 | 560 |
556 // Support for arguments.length and arguments[?]. | 561 // Support for arguments.length and arguments[?]. |
557 void GenerateArgumentsLength(ZoneList<Expression*>* args); | 562 void GenerateArgumentsLength(ZoneList<Expression*>* args); |
558 void GenerateArgumentsAccess(ZoneList<Expression*>* args); | 563 void GenerateArguments(ZoneList<Expression*>* args); |
559 | 564 |
560 // Support for accessing the class and value fields of an object. | 565 // Support for accessing the class and value fields of an object. |
561 void GenerateClassOf(ZoneList<Expression*>* args); | 566 void GenerateClassOf(ZoneList<Expression*>* args); |
562 void GenerateValueOf(ZoneList<Expression*>* args); | 567 void GenerateValueOf(ZoneList<Expression*>* args); |
563 void GenerateSetValueOf(ZoneList<Expression*>* args); | 568 void GenerateSetValueOf(ZoneList<Expression*>* args); |
564 | 569 |
565 // Fast support for charCodeAt(n). | 570 // Fast support for charCodeAt(n). |
566 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | 571 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); |
567 | 572 |
568 // Fast support for string.charAt(n) and string[n]. | 573 // Fast support for string.charAt(n) and string[n]. |
(...skipping 17 matching lines...) Expand all Loading... |
586 | 591 |
587 // Fast support for StringCompare. | 592 // Fast support for StringCompare. |
588 void GenerateStringCompare(ZoneList<Expression*>* args); | 593 void GenerateStringCompare(ZoneList<Expression*>* args); |
589 | 594 |
590 // Support for direct calls from JavaScript to native RegExp code. | 595 // Support for direct calls from JavaScript to native RegExp code. |
591 void GenerateRegExpExec(ZoneList<Expression*>* args); | 596 void GenerateRegExpExec(ZoneList<Expression*>* args); |
592 | 597 |
593 // Fast support for number to string. | 598 // Fast support for number to string. |
594 void GenerateNumberToString(ZoneList<Expression*>* args); | 599 void GenerateNumberToString(ZoneList<Expression*>* args); |
595 | 600 |
596 // Fast support for Math.pow(). | 601 // Fast call to math functions. |
597 void GenerateMathPow(ZoneList<Expression*>* args); | 602 void GenerateMathPow(ZoneList<Expression*>* args); |
598 | |
599 // Fast call to transcendental functions. | |
600 void GenerateMathSin(ZoneList<Expression*>* args); | 603 void GenerateMathSin(ZoneList<Expression*>* args); |
601 void GenerateMathCos(ZoneList<Expression*>* args); | 604 void GenerateMathCos(ZoneList<Expression*>* args); |
602 | |
603 // Fast case for sqrt | |
604 void GenerateMathSqrt(ZoneList<Expression*>* args); | 605 void GenerateMathSqrt(ZoneList<Expression*>* args); |
605 | 606 |
606 // Simple condition analysis. | 607 // Simple condition analysis. |
607 enum ConditionAnalysis { | 608 enum ConditionAnalysis { |
608 ALWAYS_TRUE, | 609 ALWAYS_TRUE, |
609 ALWAYS_FALSE, | 610 ALWAYS_FALSE, |
610 DONT_KNOW | 611 DONT_KNOW |
611 }; | 612 }; |
612 ConditionAnalysis AnalyzeCondition(Expression* cond); | 613 ConditionAnalysis AnalyzeCondition(Expression* cond); |
613 | 614 |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 void Print() { | 973 void Print() { |
973 PrintF("NumberToStringStub\n"); | 974 PrintF("NumberToStringStub\n"); |
974 } | 975 } |
975 #endif | 976 #endif |
976 }; | 977 }; |
977 | 978 |
978 | 979 |
979 } } // namespace v8::internal | 980 } } // namespace v8::internal |
980 | 981 |
981 #endif // V8_IA32_CODEGEN_IA32_H_ | 982 #endif // V8_IA32_CODEGEN_IA32_H_ |
OLD | NEW |