| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 #endif | 220 #endif |
| 221 if (!result->IsUndefined()) { | 221 if (!result->IsUndefined()) { |
| 222 // If all went well and the result wasn't undefined then print | 222 // If all went well and the result wasn't undefined then print |
| 223 // the returned value. | 223 // the returned value. |
| 224 v8::String::Utf8Value str(result); | 224 v8::String::Utf8Value str(result); |
| 225 fwrite(*str, sizeof(**str), str.length(), stdout); | 225 fwrite(*str, sizeof(**str), str.length(), stdout); |
| 226 printf("\n"); | 226 printf("\n"); |
| 227 } | 227 } |
| 228 #if !defined(V8_SHARED) | 228 #if !defined(V8_SHARED) |
| 229 } else { | 229 } else { |
| 230 v8::TryCatch try_catch; |
| 230 Context::Scope context_scope(utility_context_); | 231 Context::Scope context_scope(utility_context_); |
| 231 Handle<Object> global = utility_context_->Global(); | 232 Handle<Object> global = utility_context_->Global(); |
| 232 Handle<Value> fun = global->Get(String::New("Stringify")); | 233 Handle<Value> fun = global->Get(String::New("Stringify")); |
| 233 Handle<Value> argv[1] = { result }; | 234 Handle<Value> argv[1] = { result }; |
| 234 Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv); | 235 Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv); |
| 236 if (try_catch.HasCaught()) return true; |
| 235 v8::String::Utf8Value str(s); | 237 v8::String::Utf8Value str(s); |
| 236 fwrite(*str, sizeof(**str), str.length(), stdout); | 238 fwrite(*str, sizeof(**str), str.length(), stdout); |
| 237 printf("\n"); | 239 printf("\n"); |
| 238 } | 240 } |
| 239 #endif | 241 #endif |
| 240 } | 242 } |
| 241 return true; | 243 return true; |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 } | 246 } |
| (...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 } | 1987 } |
| 1986 | 1988 |
| 1987 } // namespace v8 | 1989 } // namespace v8 |
| 1988 | 1990 |
| 1989 | 1991 |
| 1990 #ifndef GOOGLE3 | 1992 #ifndef GOOGLE3 |
| 1991 int main(int argc, char* argv[]) { | 1993 int main(int argc, char* argv[]) { |
| 1992 return v8::Shell::Main(argc, argv); | 1994 return v8::Shell::Main(argc, argv); |
| 1993 } | 1995 } |
| 1994 #endif | 1996 #endif |
| OLD | NEW |