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

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

Issue 2611643002: [modules] Add an IsModule flag to ScriptOriginOptions. (Closed)
Patch Set: Created 3 years, 11 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 59
60 static Handle<JSFunction> Compile(const char* source) { 60 static Handle<JSFunction> Compile(const char* source) {
61 Isolate* isolate = CcTest::i_isolate(); 61 Isolate* isolate = CcTest::i_isolate();
62 Handle<String> source_code = isolate->factory()->NewStringFromUtf8( 62 Handle<String> source_code = isolate->factory()->NewStringFromUtf8(
63 CStrVector(source)).ToHandleChecked(); 63 CStrVector(source)).ToHandleChecked();
64 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript( 64 Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript(
65 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), 65 source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(),
66 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, 66 Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL,
67 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); 67 v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE);
68 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 68 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
69 shared, isolate->native_context()); 69 shared, isolate->native_context());
70 } 70 }
71 71
72 72
73 static double Inc(Isolate* isolate, int x) { 73 static double Inc(Isolate* isolate, int x) {
74 const char* source = "result = %d + 1;"; 74 const char* source = "result = %d + 1;";
75 EmbeddedVector<char, 512> buffer; 75 EmbeddedVector<char, 512> buffer;
76 SNPrintF(buffer, source, x); 76 SNPrintF(buffer, source, x);
77 77
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 CompileRun("foo()"); 666 CompileRun("foo()");
667 CHECK_EQ(2, foo->feedback_vector()->invocation_count()); 667 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
668 CompileRun("bar()"); 668 CompileRun("bar()");
669 CHECK_EQ(2, foo->feedback_vector()->invocation_count()); 669 CHECK_EQ(2, foo->feedback_vector()->invocation_count());
670 CompileRun("foo(); foo()"); 670 CompileRun("foo(); foo()");
671 CHECK_EQ(4, foo->feedback_vector()->invocation_count()); 671 CHECK_EQ(4, foo->feedback_vector()->invocation_count());
672 CompileRun("%BaselineFunctionOnNextCall(foo);"); 672 CompileRun("%BaselineFunctionOnNextCall(foo);");
673 CompileRun("foo();"); 673 CompileRun("foo();");
674 CHECK_EQ(5, foo->feedback_vector()->invocation_count()); 674 CHECK_EQ(5, foo->feedback_vector()->invocation_count());
675 } 675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698