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

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

Issue 23534067: bulk replace Isolate::Current in tests (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « test/cctest/test-ast.cc ('k') | test/cctest/test-cpu-profiler.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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 printf("\n"); 73 printf("\n");
74 } 74 }
75 75
76 76
77 static PrintExtension kPrintExtension; 77 static PrintExtension kPrintExtension;
78 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension); 78 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension);
79 79
80 80
81 static MaybeObject* GetGlobalProperty(const char* name) { 81 static MaybeObject* GetGlobalProperty(const char* name) {
82 Isolate* isolate = Isolate::Current(); 82 Isolate* isolate = CcTest::i_isolate();
83 Handle<String> internalized_name = 83 Handle<String> internalized_name =
84 isolate->factory()->InternalizeUtf8String(name); 84 isolate->factory()->InternalizeUtf8String(name);
85 return isolate->context()->global_object()->GetProperty(*internalized_name); 85 return isolate->context()->global_object()->GetProperty(*internalized_name);
86 } 86 }
87 87
88 88
89 static void SetGlobalProperty(const char* name, Object* value) { 89 static void SetGlobalProperty(const char* name, Object* value) {
90 Isolate* isolate = Isolate::Current(); 90 Isolate* isolate = CcTest::i_isolate();
91 Handle<Object> object(value, isolate); 91 Handle<Object> object(value, isolate);
92 Handle<String> internalized_name = 92 Handle<String> internalized_name =
93 isolate->factory()->InternalizeUtf8String(name); 93 isolate->factory()->InternalizeUtf8String(name);
94 Handle<JSObject> global(isolate->context()->global_object()); 94 Handle<JSObject> global(isolate->context()->global_object());
95 SetProperty(isolate, global, internalized_name, object, NONE, kNonStrictMode); 95 SetProperty(isolate, global, internalized_name, object, NONE, kNonStrictMode);
96 } 96 }
97 97
98 98
99 static Handle<JSFunction> Compile(const char* source) { 99 static Handle<JSFunction> Compile(const char* source) {
100 Isolate* isolate = Isolate::Current(); 100 Isolate* isolate = CcTest::i_isolate();
101 Handle<String> source_code( 101 Handle<String> source_code(
102 isolate->factory()->NewStringFromUtf8(CStrVector(source))); 102 isolate->factory()->NewStringFromUtf8(CStrVector(source)));
103 Handle<SharedFunctionInfo> shared_function = 103 Handle<SharedFunctionInfo> shared_function =
104 Compiler::Compile(source_code, 104 Compiler::Compile(source_code,
105 Handle<String>(), 105 Handle<String>(),
106 0, 106 0,
107 0, 107 0,
108 false, 108 false,
109 Handle<Context>(isolate->native_context()), 109 Handle<Context>(isolate->native_context()),
110 NULL, 110 NULL,
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 argv, 305 argv,
306 &has_pending_exception); 306 &has_pending_exception);
307 CHECK(!has_pending_exception); 307 CHECK(!has_pending_exception);
308 } 308 }
309 309
310 310
311 // Regression 236. Calling InitLineEnds on a Script with undefined 311 // Regression 236. Calling InitLineEnds on a Script with undefined
312 // source resulted in crash. 312 // source resulted in crash.
313 TEST(Regression236) { 313 TEST(Regression236) {
314 CcTest::InitializeVM(); 314 CcTest::InitializeVM();
315 Isolate* isolate = Isolate::Current(); 315 Isolate* isolate = CcTest::i_isolate();
316 Factory* factory = isolate->factory(); 316 Factory* factory = isolate->factory();
317 v8::HandleScope scope(CcTest::isolate()); 317 v8::HandleScope scope(CcTest::isolate());
318 318
319 Handle<Script> script = factory->NewScript(factory->empty_string()); 319 Handle<Script> script = factory->NewScript(factory->empty_string());
320 script->set_source(HEAP->undefined_value()); 320 script->set_source(HEAP->undefined_value());
321 CHECK_EQ(-1, GetScriptLineNumber(script, 0)); 321 CHECK_EQ(-1, GetScriptLineNumber(script, 0));
322 CHECK_EQ(-1, GetScriptLineNumber(script, 100)); 322 CHECK_EQ(-1, GetScriptLineNumber(script, 100));
323 CHECK_EQ(-1, GetScriptLineNumber(script, -1)); 323 CHECK_EQ(-1, GetScriptLineNumber(script, -1));
324 } 324 }
325 325
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 CompileRun("function f() { a = 12345678 }; f();"); 426 CompileRun("function f() { a = 12345678 }; f();");
427 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 427 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
428 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 428 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
429 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 429 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
430 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 430 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
431 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 431 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
432 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 432 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
433 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 433 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
434 } 434 }
435 #endif 435 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-ast.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698