| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 RegisterAllocator* allocator() const { return allocator_; } | 330 RegisterAllocator* allocator() const { return allocator_; } |
| 331 | 331 |
| 332 CodeGenState* state() { return state_; } | 332 CodeGenState* state() { return state_; } |
| 333 void set_state(CodeGenState* state) { state_ = state; } | 333 void set_state(CodeGenState* state) { state_ = state; } |
| 334 | 334 |
| 335 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 335 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
| 336 | 336 |
| 337 bool in_spilled_code() const { return in_spilled_code_; } | 337 bool in_spilled_code() const { return in_spilled_code_; } |
| 338 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } | 338 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } |
| 339 | 339 |
| 340 // If the name is an inline runtime function call return the number of |
| 341 // expected arguments. Otherwise return -1. |
| 342 static int InlineRuntimeCallArgumentsCount(Handle<String> name); |
| 343 |
| 340 private: | 344 private: |
| 341 // Construction/Destruction | 345 // Construction/Destruction |
| 342 explicit CodeGenerator(MacroAssembler* masm); | 346 explicit CodeGenerator(MacroAssembler* masm); |
| 343 | 347 |
| 344 // Accessors | 348 // Accessors |
| 345 inline bool is_eval(); | 349 inline bool is_eval(); |
| 346 inline Scope* scope(); | 350 inline Scope* scope(); |
| 347 | 351 |
| 348 // Generating deferred code. | 352 // Generating deferred code. |
| 349 void ProcessDeferred(); | 353 void ProcessDeferred(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 void CallApplyLazy(Expression* applicand, | 503 void CallApplyLazy(Expression* applicand, |
| 500 Expression* receiver, | 504 Expression* receiver, |
| 501 VariableProxy* arguments, | 505 VariableProxy* arguments, |
| 502 int position); | 506 int position); |
| 503 | 507 |
| 504 void CheckStack(); | 508 void CheckStack(); |
| 505 | 509 |
| 506 struct InlineRuntimeLUT { | 510 struct InlineRuntimeLUT { |
| 507 void (CodeGenerator::*method)(ZoneList<Expression*>*); | 511 void (CodeGenerator::*method)(ZoneList<Expression*>*); |
| 508 const char* name; | 512 const char* name; |
| 513 int nargs; |
| 509 }; | 514 }; |
| 510 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | 515 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); |
| 511 bool CheckForInlineRuntimeCall(CallRuntime* node); | 516 bool CheckForInlineRuntimeCall(CallRuntime* node); |
| 512 static bool PatchInlineRuntimeEntry(Handle<String> name, | 517 static bool PatchInlineRuntimeEntry(Handle<String> name, |
| 513 const InlineRuntimeLUT& new_entry, | 518 const InlineRuntimeLUT& new_entry, |
| 514 InlineRuntimeLUT* old_entry); | 519 InlineRuntimeLUT* old_entry); |
| 515 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 520 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
| 516 | 521 |
| 517 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); | 522 static Handle<Code> ComputeCallInitialize(int argc, InLoopFlag in_loop); |
| 518 | 523 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 530 void GenerateIsRegExp(ZoneList<Expression*>* args); | 535 void GenerateIsRegExp(ZoneList<Expression*>* args); |
| 531 void GenerateIsObject(ZoneList<Expression*>* args); | 536 void GenerateIsObject(ZoneList<Expression*>* args); |
| 532 void GenerateIsFunction(ZoneList<Expression*>* args); | 537 void GenerateIsFunction(ZoneList<Expression*>* args); |
| 533 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); | 538 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); |
| 534 | 539 |
| 535 // Support for construct call checks. | 540 // Support for construct call checks. |
| 536 void GenerateIsConstructCall(ZoneList<Expression*>* args); | 541 void GenerateIsConstructCall(ZoneList<Expression*>* args); |
| 537 | 542 |
| 538 // Support for arguments.length and arguments[?]. | 543 // Support for arguments.length and arguments[?]. |
| 539 void GenerateArgumentsLength(ZoneList<Expression*>* args); | 544 void GenerateArgumentsLength(ZoneList<Expression*>* args); |
| 540 void GenerateArgumentsAccess(ZoneList<Expression*>* args); | 545 void GenerateArguments(ZoneList<Expression*>* args); |
| 541 | 546 |
| 542 // Support for accessing the class and value fields of an object. | 547 // Support for accessing the class and value fields of an object. |
| 543 void GenerateClassOf(ZoneList<Expression*>* args); | 548 void GenerateClassOf(ZoneList<Expression*>* args); |
| 544 void GenerateValueOf(ZoneList<Expression*>* args); | 549 void GenerateValueOf(ZoneList<Expression*>* args); |
| 545 void GenerateSetValueOf(ZoneList<Expression*>* args); | 550 void GenerateSetValueOf(ZoneList<Expression*>* args); |
| 546 | 551 |
| 547 // Fast support for charCodeAt(n). | 552 // Fast support for charCodeAt(n). |
| 548 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | 553 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); |
| 549 | 554 |
| 550 // Fast support for string.charAt(n) and string[n]. | 555 // Fast support for string.charAt(n) and string[n]. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 568 | 573 |
| 569 // Fast support for StringCompare. | 574 // Fast support for StringCompare. |
| 570 void GenerateStringCompare(ZoneList<Expression*>* args); | 575 void GenerateStringCompare(ZoneList<Expression*>* args); |
| 571 | 576 |
| 572 // Support for direct calls from JavaScript to native RegExp code. | 577 // Support for direct calls from JavaScript to native RegExp code. |
| 573 void GenerateRegExpExec(ZoneList<Expression*>* args); | 578 void GenerateRegExpExec(ZoneList<Expression*>* args); |
| 574 | 579 |
| 575 // Fast support for number to string. | 580 // Fast support for number to string. |
| 576 void GenerateNumberToString(ZoneList<Expression*>* args); | 581 void GenerateNumberToString(ZoneList<Expression*>* args); |
| 577 | 582 |
| 578 // Fast support for Math.pow(). | 583 // Fast call to math functions. |
| 579 void GenerateMathPow(ZoneList<Expression*>* args); | 584 void GenerateMathPow(ZoneList<Expression*>* args); |
| 580 | |
| 581 // Fast call to math functions. | |
| 582 void GenerateMathSin(ZoneList<Expression*>* args); | 585 void GenerateMathSin(ZoneList<Expression*>* args); |
| 583 void GenerateMathCos(ZoneList<Expression*>* args); | 586 void GenerateMathCos(ZoneList<Expression*>* args); |
| 584 | |
| 585 // Fast case for sqrt | |
| 586 void GenerateMathSqrt(ZoneList<Expression*>* args); | 587 void GenerateMathSqrt(ZoneList<Expression*>* args); |
| 587 | 588 |
| 588 // Simple condition analysis. | 589 // Simple condition analysis. |
| 589 enum ConditionAnalysis { | 590 enum ConditionAnalysis { |
| 590 ALWAYS_TRUE, | 591 ALWAYS_TRUE, |
| 591 ALWAYS_FALSE, | 592 ALWAYS_FALSE, |
| 592 DONT_KNOW | 593 DONT_KNOW |
| 593 }; | 594 }; |
| 594 ConditionAnalysis AnalyzeCondition(Expression* cond); | 595 ConditionAnalysis AnalyzeCondition(Expression* cond); |
| 595 | 596 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 Major MajorKey() { return StringCompare; } | 861 Major MajorKey() { return StringCompare; } |
| 861 int MinorKey() { return 0; } | 862 int MinorKey() { return 0; } |
| 862 | 863 |
| 863 void Generate(MacroAssembler* masm); | 864 void Generate(MacroAssembler* masm); |
| 864 }; | 865 }; |
| 865 | 866 |
| 866 | 867 |
| 867 } } // namespace v8::internal | 868 } } // namespace v8::internal |
| 868 | 869 |
| 869 #endif // V8_X64_CODEGEN_X64_H_ | 870 #endif // V8_X64_CODEGEN_X64_H_ |
| OLD | NEW |