| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // CodeGenerator | 164 // CodeGenerator |
| 165 | 165 |
| 166 class CodeGenerator: public AstVisitor { | 166 class CodeGenerator: public AstVisitor { |
| 167 public: | 167 public: |
| 168 // Takes a function literal, generates code for it. This function should only | 168 // Takes a function literal, generates code for it. This function should only |
| 169 // be called by compiler.cc. | 169 // be called by compiler.cc. |
| 170 static Handle<Code> MakeCode(FunctionLiteral* fun, | 170 static Handle<Code> MakeCode(FunctionLiteral* fun, |
| 171 Handle<Script> script, | 171 Handle<Script> script, |
| 172 bool is_eval); | 172 bool is_eval); |
| 173 | 173 |
| 174 static bool ShouldGenerateLog(Expression* type); |
| 175 |
| 174 static void SetFunctionInfo(Handle<JSFunction> fun, | 176 static void SetFunctionInfo(Handle<JSFunction> fun, |
| 175 int length, | 177 int length, |
| 176 int function_token_position, | 178 int function_token_position, |
| 177 int start_position, | 179 int start_position, |
| 178 int end_position, | 180 int end_position, |
| 179 bool is_expression, | 181 bool is_expression, |
| 180 bool is_toplevel, | 182 bool is_toplevel, |
| 181 Handle<Script> script); | 183 Handle<Script> script); |
| 182 | 184 |
| 183 // Accessors | 185 // Accessors |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // Support for accessing the value field of an object (used by Date). | 386 // Support for accessing the value field of an object (used by Date). |
| 385 void GenerateValueOf(ZoneList<Expression*>* args); | 387 void GenerateValueOf(ZoneList<Expression*>* args); |
| 386 void GenerateSetValueOf(ZoneList<Expression*>* args); | 388 void GenerateSetValueOf(ZoneList<Expression*>* args); |
| 387 | 389 |
| 388 // Fast support for charCodeAt(n). | 390 // Fast support for charCodeAt(n). |
| 389 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); | 391 void GenerateFastCharCodeAt(ZoneList<Expression*>* args); |
| 390 | 392 |
| 391 // Fast support for object equality testing. | 393 // Fast support for object equality testing. |
| 392 void GenerateObjectEquals(ZoneList<Expression*>* args); | 394 void GenerateObjectEquals(ZoneList<Expression*>* args); |
| 393 | 395 |
| 396 void GenerateLog(ZoneList<Expression*>* args); |
| 397 |
| 394 | 398 |
| 395 // Methods and constants for fast case switch statement support. | 399 // Methods and constants for fast case switch statement support. |
| 396 // | 400 // |
| 397 // Only allow fast-case switch if the range of labels is at most | 401 // Only allow fast-case switch if the range of labels is at most |
| 398 // this factor times the number of case labels. | 402 // this factor times the number of case labels. |
| 399 // Value is derived from comparing the size of code generated by the normal | 403 // Value is derived from comparing the size of code generated by the normal |
| 400 // switch code for Smi-labels to the size of a single pointer. If code | 404 // switch code for Smi-labels to the size of a single pointer. If code |
| 401 // quality increases this number should be decreased to match. | 405 // quality increases this number should be decreased to match. |
| 402 static const int kFastSwitchMaxOverheadFactor = 5; | 406 static const int kFastSwitchMaxOverheadFactor = 5; |
| 403 | 407 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 cgen_->set_in_spilled_code(false); | 510 cgen_->set_in_spilled_code(false); |
| 507 GetValue(typeof_state); | 511 GetValue(typeof_state); |
| 508 cgen_->frame()->SpillAll(); | 512 cgen_->frame()->SpillAll(); |
| 509 cgen_->set_in_spilled_code(true); | 513 cgen_->set_in_spilled_code(true); |
| 510 } | 514 } |
| 511 | 515 |
| 512 | 516 |
| 513 } } // namespace v8::internal | 517 } } // namespace v8::internal |
| 514 | 518 |
| 515 #endif // V8_CODEGEN_IA32_H_ | 519 #endif // V8_CODEGEN_IA32_H_ |
| OLD | NEW |