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

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

Issue 902093002: Add basic compilation support for modules (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add TODO Created 5 years, 10 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
« no previous file with comments | « test/cctest/compiler/test-linkage.cc ('k') | test/cctest/test-modules.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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 56
57 57
58 static Handle<JSFunction> Compile(const char* source) { 58 static Handle<JSFunction> Compile(const char* source) {
59 Isolate* isolate = CcTest::i_isolate(); 59 Isolate* isolate = CcTest::i_isolate();
60 Handle<String> source_code = isolate->factory()->NewStringFromUtf8( 60 Handle<String> source_code = isolate->factory()->NewStringFromUtf8(
61 CStrVector(source)).ToHandleChecked(); 61 CStrVector(source)).ToHandleChecked();
62 Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript( 62 Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript(
63 source_code, Handle<String>(), 0, 0, false, false, 63 source_code, Handle<String>(), 0, 0, false, false,
64 Handle<Context>(isolate->native_context()), NULL, NULL, 64 Handle<Context>(isolate->native_context()), NULL, NULL,
65 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE); 65 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false);
66 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 66 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
67 shared_function, isolate->native_context()); 67 shared_function, isolate->native_context());
68 } 68 }
69 69
70 70
71 static double Inc(Isolate* isolate, int x) { 71 static double Inc(Isolate* isolate, int x) {
72 const char* source = "result = %d + 1;"; 72 const char* source = "result = %d + 1;";
73 EmbeddedVector<char, 512> buffer; 73 EmbeddedVector<char, 512> buffer;
74 SNPrintF(buffer, source, x); 74 SNPrintF(buffer, source, x);
75 75
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 CompileRun("function f() { a = 12345678 }; f();"); 449 CompileRun("function f() { a = 12345678 }; f();");
450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 450 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
451 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 451 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 452 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
453 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 453 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
454 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 454 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
455 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 455 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
456 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 456 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
457 } 457 }
458 #endif 458 #endif
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-linkage.cc ('k') | test/cctest/test-modules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698