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