| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 // The minimal number of cases in a switch before the fast-case switch | 363 // The minimal number of cases in a switch before the fast-case switch |
| 364 // optimization is enabled. Each platform should return a value that | 364 // optimization is enabled. Each platform should return a value that |
| 365 // is optimal compared to the default code generated for a switch statement | 365 // is optimal compared to the default code generated for a switch statement |
| 366 // on that platform. | 366 // on that platform. |
| 367 int FastCaseSwitchMinCaseCount(); | 367 int FastCaseSwitchMinCaseCount(); |
| 368 | 368 |
| 369 // Allocate a jump table and create code to jump through it. | 369 // Allocate a jump table and create code to jump through it. |
| 370 // Should call GenerateFastCaseSwitchCases to generate the code for | 370 // Should call GenerateFastCaseSwitchCases to generate the code for |
| 371 // all the cases at the appropriate point. | 371 // all the cases at the appropriate point. |
| 372 void GenerateFastCaseSwitchJumpTable(SwitchStatement* node, int min_index, | 372 void GenerateFastCaseSwitchJumpTable(SwitchStatement* node, |
| 373 int range, Label *fail_label, | 373 int min_index, |
| 374 SmartPointer<Label*> &case_targets, | 374 int range, |
| 375 SmartPointer<Label>& case_labels); | 375 Label* fail_label, |
| 376 Vector<Label*> case_targets, |
| 377 Vector<Label> case_labels); |
| 376 | 378 |
| 377 // Generate the code for cases for the fast case switch. | 379 // Generate the code for cases for the fast case switch. |
| 378 // Called by GenerateFastCaseSwitchJumpTable. | 380 // Called by GenerateFastCaseSwitchJumpTable. |
| 379 void GenerateFastCaseSwitchCases(SwitchStatement* node, | 381 void GenerateFastCaseSwitchCases(SwitchStatement* node, |
| 380 SmartPointer<Label> &case_labels); | 382 Vector<Label> case_labels); |
| 381 | 383 |
| 382 // Fast support for constant-Smi switches. | 384 // Fast support for constant-Smi switches. |
| 383 void GenerateFastCaseSwitchStatement(SwitchStatement *node, int min_index, | 385 void GenerateFastCaseSwitchStatement(SwitchStatement* node, |
| 384 int range, int default_index); | 386 int min_index, |
| 387 int range, |
| 388 int default_index); |
| 385 | 389 |
| 386 // Fast support for constant-Smi switches. Tests whether switch statement | 390 // Fast support for constant-Smi switches. Tests whether switch statement |
| 387 // permits optimization and calls GenerateFastCaseSwitch if it does. | 391 // permits optimization and calls GenerateFastCaseSwitch if it does. |
| 388 // Returns true if the fast-case switch was generated, and false if not. | 392 // Returns true if the fast-case switch was generated, and false if not. |
| 389 bool TryGenerateFastCaseSwitchStatement(SwitchStatement *node); | 393 bool TryGenerateFastCaseSwitchStatement(SwitchStatement* node); |
| 390 | 394 |
| 391 | 395 |
| 392 // Bottle-neck interface to call the Assembler to generate the statement | 396 // Bottle-neck interface to call the Assembler to generate the statement |
| 393 // position. This allows us to easily control whether statement positions | 397 // position. This allows us to easily control whether statement positions |
| 394 // should be generated or not. | 398 // should be generated or not. |
| 395 void RecordStatementPosition(Node* node); | 399 void RecordStatementPosition(Node* node); |
| 396 | 400 |
| 397 bool is_eval_; // Tells whether code is generated for eval. | 401 bool is_eval_; // Tells whether code is generated for eval. |
| 398 Handle<Script> script_; | 402 Handle<Script> script_; |
| 399 List<DeferredCode*> deferred_; | 403 List<DeferredCode*> deferred_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 415 friend class VirtualFrame; | 419 friend class VirtualFrame; |
| 416 friend class Reference; | 420 friend class Reference; |
| 417 | 421 |
| 418 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); | 422 DISALLOW_COPY_AND_ASSIGN(CodeGenerator); |
| 419 }; | 423 }; |
| 420 | 424 |
| 421 | 425 |
| 422 } } // namespace v8::internal | 426 } } // namespace v8::internal |
| 423 | 427 |
| 424 #endif // V8_CODEGEN_IA32_H_ | 428 #endif // V8_CODEGEN_IA32_H_ |
| OLD | NEW |