Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: test/cctest/test-compiler.cc

Issue 227163008: Change exception type to Object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 v8::HandleScope scope(CcTest::isolate()); 213 v8::HandleScope scope(CcTest::isolate());
214 214
215 const char* source = "throw 42;"; 215 const char* source = "throw 42;";
216 Handle<JSFunction> fun = Compile(source); 216 Handle<JSFunction> fun = Compile(source);
217 CHECK(!fun.is_null()); 217 CHECK(!fun.is_null());
218 bool has_pending_exception; 218 bool has_pending_exception;
219 Isolate* isolate = fun->GetIsolate(); 219 Isolate* isolate = fun->GetIsolate();
220 Handle<JSObject> global(isolate->context()->global_object()); 220 Handle<JSObject> global(isolate->context()->global_object());
221 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); 221 Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception);
222 CHECK(has_pending_exception); 222 CHECK(has_pending_exception);
223 CHECK_EQ(42.0, isolate->pending_exception()->ToObjectChecked()->Number()); 223 CHECK_EQ(42.0, isolate->pending_exception()->Number());
224 } 224 }
225 225
226 226
227 // Tests calling a builtin function from C/C++ code, and the builtin function 227 // Tests calling a builtin function from C/C++ code, and the builtin function
228 // performs GC. It creates a stack frame looks like following: 228 // performs GC. It creates a stack frame looks like following:
229 // | C (PerformGC) | 229 // | C (PerformGC) |
230 // | JS-to-C | 230 // | JS-to-C |
231 // | JS | 231 // | JS |
232 // | C-to-JS | 232 // | C-to-JS |
233 TEST(C2JSFrames) { 233 TEST(C2JSFrames) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 CompileRun("function f() { a = 12345678 }; f();"); 393 CompileRun("function f() { a = 12345678 }; f();");
394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
395 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 395 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
401 } 401 }
402 #endif 402 #endif
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698