OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
6 #include "vm/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/object.h" | 8 #include "vm/object.h" |
9 #include "vm/pages.h" | 9 #include "vm/pages.h" |
10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); | 48 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); |
49 written += OS::SNPrint((scriptChars + written), | 49 written += OS::SNPrint((scriptChars + written), |
50 (kScriptSize - written), | 50 (kScriptSize - written), |
51 "%s", | 51 "%s", |
52 buffer); | 52 buffer); |
53 } | 53 } |
54 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 54 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
55 source = String::New(scriptChars); | 55 source = String::New(scriptChars); |
56 script = Script::New(url, source, RawScript::kScriptTag); | 56 script = Script::New(url, source, RawScript::kScriptTag); |
57 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 57 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
58 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); | 58 clsA = lib.LookupClass(String::Handle(Symbols::New(thread, "A"))); |
59 EXPECT(!clsA.IsNull()); | 59 EXPECT(!clsA.IsNull()); |
60 ClassFinalizer::ProcessPendingClasses(); | 60 ClassFinalizer::ProcessPendingClasses(); |
61 for (int i = 0; i < kNumFunctions; i++) { | 61 for (int i = 0; i < kNumFunctions; i++) { |
62 OS::SNPrint(buffer, 256, "foo%d", i); | 62 OS::SNPrint(buffer, 256, "foo%d", i); |
63 function_name = String::New(buffer); | 63 function_name = String::New(buffer); |
64 function = clsA.LookupStaticFunction(function_name); | 64 function = clsA.LookupStaticFunction(function_name); |
65 EXPECT(!function.IsNull()); | 65 EXPECT(!function.IsNull()); |
66 EXPECT(CompilerTest::TestCompileFunction(function)); | 66 EXPECT(CompilerTest::TestCompileFunction(function)); |
67 const Code& code = Code::ZoneHandle(function.CurrentCode()); | 67 const Code& code = Code::ZoneHandle(function.CurrentCode()); |
68 EXPECT(!code.IsNull()) | 68 EXPECT(!code.IsNull()) |
(...skipping 29 matching lines...) Expand all Loading... |
98 written += OS::SNPrint((scriptChars + written), | 98 written += OS::SNPrint((scriptChars + written), |
99 (kScriptSize - written), | 99 (kScriptSize - written), |
100 "%s", | 100 "%s", |
101 buffer); | 101 buffer); |
102 } | 102 } |
103 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 103 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
104 url = String::New("dart-test:FindCodeObject"); | 104 url = String::New("dart-test:FindCodeObject"); |
105 source = String::New(scriptChars); | 105 source = String::New(scriptChars); |
106 script = Script::New(url, source, RawScript::kScriptTag); | 106 script = Script::New(url, source, RawScript::kScriptTag); |
107 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 107 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
108 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); | 108 clsB = lib.LookupClass(String::Handle(Symbols::New(thread, "B"))); |
109 EXPECT(!clsB.IsNull()); | 109 EXPECT(!clsB.IsNull()); |
110 ClassFinalizer::ProcessPendingClasses(); | 110 ClassFinalizer::ProcessPendingClasses(); |
111 for (int i = 0; i < kNumFunctions; i++) { | 111 for (int i = 0; i < kNumFunctions; i++) { |
112 OS::SNPrint(buffer, 256, "moo%d", i); | 112 OS::SNPrint(buffer, 256, "moo%d", i); |
113 function_name = String::New(buffer); | 113 function_name = String::New(buffer); |
114 function = clsB.LookupStaticFunction(function_name); | 114 function = clsB.LookupStaticFunction(function_name); |
115 EXPECT(!function.IsNull()); | 115 EXPECT(!function.IsNull()); |
116 EXPECT(CompilerTest::TestCompileFunction(function)); | 116 EXPECT(CompilerTest::TestCompileFunction(function)); |
117 const Code& code = Code::ZoneHandle(function.CurrentCode()); | 117 const Code& code = Code::ZoneHandle(function.CurrentCode()); |
118 EXPECT(!code.IsNull()); | 118 EXPECT(!code.IsNull()); |
(...skipping 30 matching lines...) Expand all Loading... |
149 EXPECT(code.Size() > 16); | 149 EXPECT(code.Size() > 16); |
150 pc = code.EntryPoint() + 16; | 150 pc = code.EntryPoint() + 16; |
151 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); | 151 EXPECT(code.Size() > (PageSpace::kPageSizeInWords << kWordSizeLog2)); |
152 EXPECT(Code::LookupCode(pc) == code.raw()); | 152 EXPECT(Code::LookupCode(pc) == code.raw()); |
153 EXPECT(code.Size() > (1 * MB)); | 153 EXPECT(code.Size() > (1 * MB)); |
154 pc = code.EntryPoint() + (1 * MB); | 154 pc = code.EntryPoint() + (1 * MB); |
155 EXPECT(Code::LookupCode(pc) == code.raw()); | 155 EXPECT(Code::LookupCode(pc) == code.raw()); |
156 } | 156 } |
157 | 157 |
158 } // namespace dart | 158 } // namespace dart |
OLD | NEW |