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

Side by Side Diff: runtime/vm/find_code_object_test.cc

Issue 14791005: BREAKING CHANGE: enforce part of directive (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/object_test.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 (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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 OS::SNPrint(buffer, 49 OS::SNPrint(buffer,
50 256, 50 256,
51 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); 51 "static foo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
52 written += OS::SNPrint((scriptChars + written), 52 written += OS::SNPrint((scriptChars + written),
53 (kScriptSize - written), 53 (kScriptSize - written),
54 "%s", 54 "%s",
55 buffer); 55 buffer);
56 } 56 }
57 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 57 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
58 source = String::New(scriptChars); 58 source = String::New(scriptChars);
59 script = Script::New(url, source, RawScript::kSourceTag); 59 script = Script::New(url, source, RawScript::kScriptTag);
60 EXPECT(CompilerTest::TestCompileScript(lib, script)); 60 EXPECT(CompilerTest::TestCompileScript(lib, script));
61 clsA = lib.LookupClass(String::Handle(Symbols::New("A"))); 61 clsA = lib.LookupClass(String::Handle(Symbols::New("A")));
62 EXPECT(!clsA.IsNull()); 62 EXPECT(!clsA.IsNull());
63 ClassFinalizer::FinalizePendingClasses(); 63 ClassFinalizer::FinalizePendingClasses();
64 for (int i = 0; i < kNumFunctions; i++) { 64 for (int i = 0; i < kNumFunctions; i++) {
65 OS::SNPrint(buffer, 256, "foo%d", i); 65 OS::SNPrint(buffer, 256, "foo%d", i);
66 function_name = String::New(buffer); 66 function_name = String::New(buffer);
67 function = clsA.LookupStaticFunction(function_name); 67 function = clsA.LookupStaticFunction(function_name);
68 EXPECT(!function.IsNull()); 68 EXPECT(!function.IsNull());
69 EXPECT(CompilerTest::TestCompileFunction(function)); 69 EXPECT(CompilerTest::TestCompileFunction(function));
(...skipping 27 matching lines...) Expand all
97 256, 97 256,
98 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i); 98 "static moo%d([int i=1,int j=2,int k=3]){return i+j+k;}", i);
99 written += OS::SNPrint((scriptChars + written), 99 written += OS::SNPrint((scriptChars + written),
100 (kScriptSize - written), 100 (kScriptSize - written),
101 "%s", 101 "%s",
102 buffer); 102 buffer);
103 } 103 }
104 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}"); 104 OS::SNPrint((scriptChars + written), (kScriptSize - written), "}");
105 url = String::New("dart-test:FindCodeObject"); 105 url = String::New("dart-test:FindCodeObject");
106 source = String::New(scriptChars); 106 source = String::New(scriptChars);
107 script = Script::New(url, source, RawScript::kSourceTag); 107 script = Script::New(url, source, RawScript::kScriptTag);
108 EXPECT(CompilerTest::TestCompileScript(lib, script)); 108 EXPECT(CompilerTest::TestCompileScript(lib, script));
109 clsB = lib.LookupClass(String::Handle(Symbols::New("B"))); 109 clsB = lib.LookupClass(String::Handle(Symbols::New("B")));
110 EXPECT(!clsB.IsNull()); 110 EXPECT(!clsB.IsNull());
111 ClassFinalizer::FinalizePendingClasses(); 111 ClassFinalizer::FinalizePendingClasses();
112 for (int i = 0; i < kNumFunctions; i++) { 112 for (int i = 0; i < kNumFunctions; i++) {
113 OS::SNPrint(buffer, 256, "moo%d", i); 113 OS::SNPrint(buffer, 256, "moo%d", i);
114 function_name = String::New(buffer); 114 function_name = String::New(buffer);
115 function = clsB.LookupStaticFunction(function_name); 115 function = clsB.LookupStaticFunction(function_name);
116 EXPECT(!function.IsNull()); 116 EXPECT(!function.IsNull());
117 EXPECT(CompilerTest::TestCompileFunction(function)); 117 EXPECT(CompilerTest::TestCompileFunction(function));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 #else 156 #else
157 EXPECT(code.Size() > PageSpace::kPageSize); 157 EXPECT(code.Size() > PageSpace::kPageSize);
158 EXPECT(Code::LookupCode(pc) == code.raw()); 158 EXPECT(Code::LookupCode(pc) == code.raw());
159 EXPECT(code.Size() > (1 * MB)); 159 EXPECT(code.Size() > (1 * MB));
160 pc = code.EntryPoint() + (1 * MB); 160 pc = code.EntryPoint() + (1 * MB);
161 EXPECT(Code::LookupCode(pc) == code.raw()); 161 EXPECT(Code::LookupCode(pc) == code.raw());
162 #endif // defined(TARGET_ARCH_MIPS) 162 #endif // defined(TARGET_ARCH_MIPS)
163 } 163 }
164 164
165 } // namespace dart 165 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698