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

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

Issue 110203002: Refactor the compiling pipeline. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: move some code Created 7 years 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, 97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
98 kNonStrictMode); 98 kNonStrictMode);
99 } 99 }
100 100
101 101
102 static Handle<JSFunction> Compile(const char* source) { 102 static Handle<JSFunction> Compile(const char* source) {
103 Isolate* isolate = CcTest::i_isolate(); 103 Isolate* isolate = CcTest::i_isolate();
104 Handle<String> source_code( 104 Handle<String> source_code(
105 isolate->factory()->NewStringFromUtf8(CStrVector(source))); 105 isolate->factory()->NewStringFromUtf8(CStrVector(source)));
106 Handle<SharedFunctionInfo> shared_function = 106 Handle<SharedFunctionInfo> shared_function =
107 Compiler::Compile(source_code, 107 Compiler::CompileScript(source_code,
108 Handle<String>(), 108 Handle<String>(), 0, 0,
titzer 2013/12/09 14:49:28 formatting changes
Yang 2013/12/10 11:22:04 Done.
109 0, 109 false,
110 0, 110 Handle<Context>(isolate->native_context()),
111 false, 111 NULL, NULL,
112 Handle<Context>(isolate->native_context()), 112 Handle<String>::null(),
113 NULL, 113 NOT_NATIVES_CODE);
114 NULL,
115 Handle<String>::null(),
116 NOT_NATIVES_CODE);
117 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 114 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
118 shared_function, isolate->native_context()); 115 shared_function, isolate->native_context());
119 } 116 }
120 117
121 118
122 static double Inc(Isolate* isolate, int x) { 119 static double Inc(Isolate* isolate, int x) {
123 const char* source = "result = %d + 1;"; 120 const char* source = "result = %d + 1;";
124 EmbeddedVector<char, 512> buffer; 121 EmbeddedVector<char, 512> buffer;
125 OS::SNPrintF(buffer, source, x); 122 OS::SNPrintF(buffer, source, x);
126 123
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 CompileRun("function f() { a = 12345678 }; f();"); 435 CompileRun("function f() { a = 12345678 }; f();");
439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 436 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 437 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 438 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 439 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 440 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 441 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 442 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
446 } 443 }
447 #endif 444 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698