| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return result; | 79 return result; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 static bool IsValidJSON(FunctionLiteral* lit) { | 83 static bool IsValidJSON(FunctionLiteral* lit) { |
| 84 if (!lit->body()->length() == 1) | 84 if (!lit->body()->length() == 1) |
| 85 return false; | 85 return false; |
| 86 Statement* stmt = lit->body()->at(0); | 86 Statement* stmt = lit->body()->at(0); |
| 87 if (stmt->AsExpressionStatement() == NULL) | 87 if (stmt->AsExpressionStatement() == NULL) |
| 88 return false; | 88 return false; |
| 89 Expression *expr = stmt->AsExpressionStatement()->expression(); | 89 Expression* expr = stmt->AsExpressionStatement()->expression(); |
| 90 return expr->IsValidJSON(); | 90 return expr->IsValidJSON(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 static Handle<JSFunction> MakeFunction(bool is_global, | 94 static Handle<JSFunction> MakeFunction(bool is_global, |
| 95 bool is_eval, | 95 bool is_eval, |
| 96 bool is_json, | 96 bool is_json, |
| 97 Handle<Script> script, | 97 Handle<Script> script, |
| 98 Handle<Context> context, | 98 Handle<Context> context, |
| 99 v8::Extension* extension, | 99 v8::Extension* extension, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // Set the expected number of properties for instances. | 383 // Set the expected number of properties for instances. |
| 384 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); | 384 SetExpectedNofPropertiesFromEstimate(shared, lit->expected_property_count()); |
| 385 | 385 |
| 386 // Check the function has compiled code. | 386 // Check the function has compiled code. |
| 387 ASSERT(shared->is_compiled()); | 387 ASSERT(shared->is_compiled()); |
| 388 return true; | 388 return true; |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 } } // namespace v8::internal | 392 } } // namespace v8::internal |
| OLD | NEW |