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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 RegisterAllocator* allocator() const { return allocator_; } | 191 RegisterAllocator* allocator() const { return allocator_; } |
192 | 192 |
193 CodeGenState* state() { return state_; } | 193 CodeGenState* state() { return state_; } |
194 void set_state(CodeGenState* state) { state_ = state; } | 194 void set_state(CodeGenState* state) { state_ = state; } |
195 | 195 |
196 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } | 196 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
197 | 197 |
198 static const int kUnknownIntValue = -1; | 198 static const int kUnknownIntValue = -1; |
199 | 199 |
| 200 // If the name is an inline runtime function call return the number of |
| 201 // expected arguments. Otherwise return -1. |
| 202 static int InlineRuntimeCallArgumentsCount(Handle<String> name); |
| 203 |
200 private: | 204 private: |
201 // Construction/Destruction | 205 // Construction/Destruction |
202 explicit CodeGenerator(MacroAssembler* masm); | 206 explicit CodeGenerator(MacroAssembler* masm); |
203 | 207 |
204 // Accessors | 208 // Accessors |
205 inline bool is_eval(); | 209 inline bool is_eval(); |
206 inline Scope* scope(); | 210 inline Scope* scope(); |
207 | 211 |
208 // Generating deferred code. | 212 // Generating deferred code. |
209 void ProcessDeferred(); | 213 void ProcessDeferred(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 CallFunctionFlags flags, | 323 CallFunctionFlags flags, |
320 int position); | 324 int position); |
321 | 325 |
322 // Control flow | 326 // Control flow |
323 void Branch(bool if_true, JumpTarget* target); | 327 void Branch(bool if_true, JumpTarget* target); |
324 void CheckStack(); | 328 void CheckStack(); |
325 | 329 |
326 struct InlineRuntimeLUT { | 330 struct InlineRuntimeLUT { |
327 void (CodeGenerator::*method)(ZoneList<Expression*>*); | 331 void (CodeGenerator::*method)(ZoneList<Expression*>*); |
328 const char* name; | 332 const char* name; |
| 333 int nargs; |
329 }; | 334 }; |
330 | 335 |
331 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); | 336 static InlineRuntimeLUT* FindInlineRuntimeLUT(Handle<String> name); |
332 bool CheckForInlineRuntimeCall(CallRuntime* node); | 337 bool CheckForInlineRuntimeCall(CallRuntime* node); |
333 static bool PatchInlineRuntimeEntry(Handle<String> name, | 338 static bool PatchInlineRuntimeEntry(Handle<String> name, |
334 const InlineRuntimeLUT& new_entry, | 339 const InlineRuntimeLUT& new_entry, |
335 InlineRuntimeLUT* old_entry); | 340 InlineRuntimeLUT* old_entry); |
336 | 341 |
337 static Handle<Code> ComputeLazyCompile(int argc); | 342 static Handle<Code> ComputeLazyCompile(int argc); |
338 void ProcessDeclarations(ZoneList<Declaration*>* declarations); | 343 void ProcessDeclarations(ZoneList<Declaration*>* declarations); |
(...skipping 14 matching lines...) Expand all Loading... |
353 void GenerateIsRegExp(ZoneList<Expression*>* args); | 358 void GenerateIsRegExp(ZoneList<Expression*>* args); |
354 void GenerateIsObject(ZoneList<Expression*>* args); | 359 void GenerateIsObject(ZoneList<Expression*>* args); |
355 void GenerateIsFunction(ZoneList<Expression*>* args); | 360 void GenerateIsFunction(ZoneList<Expression*>* args); |
356 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); | 361 void GenerateIsUndetectableObject(ZoneList<Expression*>* args); |
357 | 362 |
358 // Support for construct call checks. | 363 // Support for construct call checks. |
359 void GenerateIsConstructCall(ZoneList<Expression*>* args); | 364 void GenerateIsConstructCall(ZoneList<Expression*>* args); |
360 | 365 |
361 // Support for arguments.length and arguments[?]. | 366 // Support for arguments.length and arguments[?]. |
362 void GenerateArgumentsLength(ZoneList<Expression*>* args); | 367 void GenerateArgumentsLength(ZoneList<Expression*>* args); |
363 void GenerateArgumentsAccess(ZoneList<Expression*>* args); | 368 void GenerateArguments(ZoneList<Expression*>* args); |
364 | 369 |
365 // Support for accessing the class and value fields of an object. | 370 // Support for accessing the class and value fields of an object. |
366 void GenerateClassOf(ZoneList<Expression*>* args); | 371 void GenerateClassOf(ZoneList<Expression*>* args); |
367 void GenerateValueOf(ZoneList<Expression*>* args); | 372 void GenerateValueOf(ZoneList<Expression*>* args); |
368 void GenerateSetValueOf(ZoneList<Expression*>* args); | 373 void GenerateSetValueOf(ZoneList<Expression*>* args); |
369 | 374 |
370 // Fast support for charCodeAt(n). | 375 // Fast support for charCodeAt(n). |
371 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | 376 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); |
372 | 377 |
373 // Fast support for string.charAt(n) and string[n]. | 378 // Fast support for string.charAt(n) and string[n]. |
(...skipping 15 matching lines...) Expand all Loading... |
389 | 394 |
390 // Fast support for StringCompare. | 395 // Fast support for StringCompare. |
391 void GenerateStringCompare(ZoneList<Expression*>* args); | 396 void GenerateStringCompare(ZoneList<Expression*>* args); |
392 | 397 |
393 // Support for direct calls from JavaScript to native RegExp code. | 398 // Support for direct calls from JavaScript to native RegExp code. |
394 void GenerateRegExpExec(ZoneList<Expression*>* args); | 399 void GenerateRegExpExec(ZoneList<Expression*>* args); |
395 | 400 |
396 // Fast support for number to string. | 401 // Fast support for number to string. |
397 void GenerateNumberToString(ZoneList<Expression*>* args); | 402 void GenerateNumberToString(ZoneList<Expression*>* args); |
398 | 403 |
399 // Fast support for Math.pow(). | 404 // Fast call to math functions. |
400 void GenerateMathPow(ZoneList<Expression*>* args); | 405 void GenerateMathPow(ZoneList<Expression*>* args); |
401 | |
402 // Fast call to sine function. | |
403 void GenerateMathSin(ZoneList<Expression*>* args); | 406 void GenerateMathSin(ZoneList<Expression*>* args); |
404 void GenerateMathCos(ZoneList<Expression*>* args); | 407 void GenerateMathCos(ZoneList<Expression*>* args); |
405 | |
406 // Fast support for Math.pow(). | |
407 void GenerateMathSqrt(ZoneList<Expression*>* args); | 408 void GenerateMathSqrt(ZoneList<Expression*>* args); |
408 | 409 |
409 // Simple condition analysis. | 410 // Simple condition analysis. |
410 enum ConditionAnalysis { | 411 enum ConditionAnalysis { |
411 ALWAYS_TRUE, | 412 ALWAYS_TRUE, |
412 ALWAYS_FALSE, | 413 ALWAYS_FALSE, |
413 DONT_KNOW | 414 DONT_KNOW |
414 }; | 415 }; |
415 ConditionAnalysis AnalyzeCondition(Expression* cond); | 416 ConditionAnalysis AnalyzeCondition(Expression* cond); |
416 | 417 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 Major MajorKey() { return StringCompare; } | 656 Major MajorKey() { return StringCompare; } |
656 int MinorKey() { return 0; } | 657 int MinorKey() { return 0; } |
657 | 658 |
658 void Generate(MacroAssembler* masm); | 659 void Generate(MacroAssembler* masm); |
659 }; | 660 }; |
660 | 661 |
661 | 662 |
662 } } // namespace v8::internal | 663 } } // namespace v8::internal |
663 | 664 |
664 #endif // V8_ARM_CODEGEN_ARM_H_ | 665 #endif // V8_ARM_CODEGEN_ARM_H_ |
OLD | NEW |