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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 OS::SNPrint(buffer, | 46 OS::SNPrint(buffer, |
47 256, | 47 256, |
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::kSource); | 56 script = Script::New(url, source, RawScript::kSourceTag); |
57 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 57 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
58 clsA = lib.LookupClass(String::Handle(String::NewSymbol("A"))); | 58 clsA = lib.LookupClass(String::Handle(String::NewSymbol("A"))); |
59 EXPECT(!clsA.IsNull()); | 59 EXPECT(!clsA.IsNull()); |
60 ClassFinalizer::FinalizePendingClasses(); | 60 ClassFinalizer::FinalizePendingClasses(); |
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)); |
(...skipping 27 matching lines...) Expand all Loading... |
94 256, | 94 256, |
95 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); | 95 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); |
96 written += OS::SNPrint((scriptChars + written), | 96 written += OS::SNPrint((scriptChars + written), |
97 (kScriptSize - written), | 97 (kScriptSize - written), |
98 "%s", | 98 "%s", |
99 buffer); | 99 buffer); |
100 } | 100 } |
101 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); | 101 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); |
102 url = String::New("dart-test:FindCodeObject"); | 102 url = String::New("dart-test:FindCodeObject"); |
103 source = String::New(scriptChars); | 103 source = String::New(scriptChars); |
104 script = Script::New(url, source, RawScript::kSource); | 104 script = Script::New(url, source, RawScript::kSourceTag); |
105 EXPECT(CompilerTest::TestCompileScript(lib, script)); | 105 EXPECT(CompilerTest::TestCompileScript(lib, script)); |
106 clsB = lib.LookupClass(String::Handle(String::NewSymbol("B"))); | 106 clsB = lib.LookupClass(String::Handle(String::NewSymbol("B"))); |
107 EXPECT(!clsB.IsNull()); | 107 EXPECT(!clsB.IsNull()); |
108 ClassFinalizer::FinalizePendingClasses(); | 108 ClassFinalizer::FinalizePendingClasses(); |
109 for (int i = 0; i < kNumFunctions; i++) { | 109 for (int i = 0; i < kNumFunctions; i++) { |
110 OS::SNPrint(buffer, 256, "moo%d", i); | 110 OS::SNPrint(buffer, 256, "moo%d", i); |
111 function_name = String::New(buffer); | 111 function_name = String::New(buffer); |
112 function = clsB.LookupStaticFunction(function_name); | 112 function = clsB.LookupStaticFunction(function_name); |
113 EXPECT(!function.IsNull()); | 113 EXPECT(!function.IsNull()); |
114 EXPECT(CompilerTest::TestCompileFunction(function)); | 114 EXPECT(CompilerTest::TestCompileFunction(function)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 EXPECT(code.Size() > PageSpace::kPageSize); | 147 EXPECT(code.Size() > PageSpace::kPageSize); |
148 EXPECT(Code::LookupCode(pc) == code.raw()); | 148 EXPECT(Code::LookupCode(pc) == code.raw()); |
149 EXPECT(code.Size() > (1 * MB)); | 149 EXPECT(code.Size() > (1 * MB)); |
150 pc = code.EntryPoint() + (1 * MB); | 150 pc = code.EntryPoint() + (1 * MB); |
151 EXPECT(Code::LookupCode(pc) == code.raw()); | 151 EXPECT(Code::LookupCode(pc) == code.raw()); |
152 } | 152 } |
153 | 153 |
154 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | 154 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 |
155 | 155 |
156 } // namespace dart | 156 } // namespace dart |
OLD | NEW |