OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 return ReadToken(data, ' '); | 1478 return ReadToken(data, ' '); |
1479 } | 1479 } |
1480 #endif // V8_SHARED | 1480 #endif // V8_SHARED |
1481 | 1481 |
1482 | 1482 |
1483 // Reads a file into a v8 string. | 1483 // Reads a file into a v8 string. |
1484 Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { | 1484 Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) { |
1485 int size = 0; | 1485 int size = 0; |
1486 char* chars = ReadChars(isolate, name, &size); | 1486 char* chars = ReadChars(isolate, name, &size); |
1487 if (chars == NULL) return Handle<String>(); | 1487 if (chars == NULL) return Handle<String>(); |
1488 Handle<String> result = String::New(chars); | 1488 Handle<String> result = String::New(chars, size); |
1489 delete[] chars; | 1489 delete[] chars; |
1490 return result; | 1490 return result; |
1491 } | 1491 } |
1492 | 1492 |
1493 | 1493 |
1494 void Shell::RunShell(Isolate* isolate) { | 1494 void Shell::RunShell(Isolate* isolate) { |
1495 Locker locker; | 1495 Locker locker; |
1496 Context::Scope context_scope(evaluation_context_); | 1496 Context::Scope context_scope(evaluation_context_); |
1497 HandleScope outer_scope; | 1497 HandleScope outer_scope; |
1498 Handle<String> name = String::New("(d8)"); | 1498 Handle<String> name = String::New("(d8)"); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 } | 1963 } |
1964 | 1964 |
1965 } // namespace v8 | 1965 } // namespace v8 |
1966 | 1966 |
1967 | 1967 |
1968 #ifndef GOOGLE3 | 1968 #ifndef GOOGLE3 |
1969 int main(int argc, char* argv[]) { | 1969 int main(int argc, char* argv[]) { |
1970 return v8::Shell::Main(argc, argv); | 1970 return v8::Shell::Main(argc, argv); |
1971 } | 1971 } |
1972 #endif | 1972 #endif |
OLD | NEW |