OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 | 263 |
264 TEST(UncaughtThrow) { | 264 TEST(UncaughtThrow) { |
265 InitializeVM(); | 265 InitializeVM(); |
266 v8::HandleScope scope; | 266 v8::HandleScope scope; |
267 | 267 |
268 const char* source = "throw 42;"; | 268 const char* source = "throw 42;"; |
269 Handle<JSFunction> fun = Compile(source); | 269 Handle<JSFunction> fun = Compile(source); |
270 CHECK(!fun.is_null()); | 270 CHECK(!fun.is_null()); |
271 bool has_pending_exception; | 271 bool has_pending_exception; |
272 Handle<JSObject> global(Isolate::Current()->context()->global()); | 272 Handle<JSObject> global(Isolate::Current()->context()->global()); |
273 Handle<Object> result( | 273 Execution::Call(fun, global, 0, NULL, &has_pending_exception); |
274 Execution::Call(fun, global, 0, NULL, &has_pending_exception)); | |
275 CHECK(has_pending_exception); | 274 CHECK(has_pending_exception); |
276 CHECK_EQ(42.0, Isolate::Current()->pending_exception()-> | 275 CHECK_EQ(42.0, Isolate::Current()->pending_exception()-> |
277 ToObjectChecked()->Number()); | 276 ToObjectChecked()->Number()); |
278 } | 277 } |
279 | 278 |
280 | 279 |
281 // Tests calling a builtin function from C/C++ code, and the builtin function | 280 // Tests calling a builtin function from C/C++ code, and the builtin function |
282 // performs GC. It creates a stack frame looks like following: | 281 // performs GC. It creates a stack frame looks like following: |
283 // | C (PerformGC) | | 282 // | C (PerformGC) | |
284 // | JS-to-C | | 283 // | JS-to-C | |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 CompileRun("function f() { a = 12345678 }; f();"); | 396 CompileRun("function f() { a = 12345678 }; f();"); |
398 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
399 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
400 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
401 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
402 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
403 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
404 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
405 } | 404 } |
406 #endif | 405 #endif |
OLD | NEW |