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

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

Issue 239543010: Revert "Move functions from handles.cc to where they belong." (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-debug.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 20 matching lines...) Expand all
31 #include "v8.h" 31 #include "v8.h"
32 32
33 #include "compiler.h" 33 #include "compiler.h"
34 #include "disasm.h" 34 #include "disasm.h"
35 #include "cctest.h" 35 #include "cctest.h"
36 36
37 using namespace v8::internal; 37 using namespace v8::internal;
38 38
39 static Handle<Object> GetGlobalProperty(const char* name) { 39 static Handle<Object> GetGlobalProperty(const char* name) {
40 Isolate* isolate = CcTest::i_isolate(); 40 Isolate* isolate = CcTest::i_isolate();
41 Handle<String> internalized_name =
42 isolate->factory()->InternalizeUtf8String(name);
41 return Object::GetProperty( 43 return Object::GetProperty(
42 isolate, isolate->global_object(), name).ToHandleChecked(); 44 isolate->global_object(), internalized_name).ToHandleChecked();
43 } 45 }
44 46
45 47
46 static void SetGlobalProperty(const char* name, Object* value) { 48 static void SetGlobalProperty(const char* name, Object* value) {
47 Isolate* isolate = CcTest::i_isolate(); 49 Isolate* isolate = CcTest::i_isolate();
48 Handle<Object> object(value, isolate); 50 Handle<Object> object(value, isolate);
49 Handle<String> internalized_name = 51 Handle<String> internalized_name =
50 isolate->factory()->InternalizeUtf8String(name); 52 isolate->factory()->InternalizeUtf8String(name);
51 Handle<JSObject> global(isolate->context()->global_object()); 53 Handle<JSObject> global(isolate->context()->global_object());
52 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, 54 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // Regression 236. Calling InitLineEnds on a Script with undefined 252 // Regression 236. Calling InitLineEnds on a Script with undefined
251 // source resulted in crash. 253 // source resulted in crash.
252 TEST(Regression236) { 254 TEST(Regression236) {
253 CcTest::InitializeVM(); 255 CcTest::InitializeVM();
254 Isolate* isolate = CcTest::i_isolate(); 256 Isolate* isolate = CcTest::i_isolate();
255 Factory* factory = isolate->factory(); 257 Factory* factory = isolate->factory();
256 v8::HandleScope scope(CcTest::isolate()); 258 v8::HandleScope scope(CcTest::isolate());
257 259
258 Handle<Script> script = factory->NewScript(factory->empty_string()); 260 Handle<Script> script = factory->NewScript(factory->empty_string());
259 script->set_source(CcTest::heap()->undefined_value()); 261 script->set_source(CcTest::heap()->undefined_value());
260 CHECK_EQ(-1, Script::GetLineNumber(script, 0)); 262 CHECK_EQ(-1, GetScriptLineNumber(script, 0));
261 CHECK_EQ(-1, Script::GetLineNumber(script, 100)); 263 CHECK_EQ(-1, GetScriptLineNumber(script, 100));
262 CHECK_EQ(-1, Script::GetLineNumber(script, -1)); 264 CHECK_EQ(-1, GetScriptLineNumber(script, -1));
263 } 265 }
264 266
265 267
266 TEST(GetScriptLineNumber) { 268 TEST(GetScriptLineNumber) {
267 LocalContext context; 269 LocalContext context;
268 v8::HandleScope scope(CcTest::isolate()); 270 v8::HandleScope scope(CcTest::isolate());
269 v8::ScriptOrigin origin = 271 v8::ScriptOrigin origin =
270 v8::ScriptOrigin(v8::String::NewFromUtf8(CcTest::isolate(), "test")); 272 v8::ScriptOrigin(v8::String::NewFromUtf8(CcTest::isolate(), "test"));
271 const char function_f[] = "function f() {}"; 273 const char function_f[] = "function f() {}";
272 const int max_rows = 1000; 274 const int max_rows = 1000;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 CompileRun("function f() { a = 12345678 }; f();"); 373 CompileRun("function f() { a = 12345678 }; f();");
372 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
373 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 375 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
375 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 377 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
377 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 379 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 380 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
379 } 381 }
380 #endif 382 #endif
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698