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

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

Issue 25909002: Sampling profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
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 "vm/assembler.h" 5 #include "vm/assembler.h"
6 #include "vm/bigint_operations.h" 6 #include "vm/bigint_operations.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 #include "vm/object_store.h" 12 #include "vm/object_store.h"
13 #include "vm/simulator.h" 13 #include "vm/simulator.h"
14 #include "vm/symbols.h" 14 #include "vm/symbols.h"
15 #include "vm/unit_test.h" 15 #include "vm/unit_test.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 static RawLibrary* CreateDummyLibrary(const String& library_name) {
20 const Library& lib = Library::Handle(Library::New(library_name));
21 return lib.raw();
siva 2013/10/28 05:19:21 why not just return Library::New(library_name);
Cutch 2013/11/04 20:36:05 Done.
22 }
23
24
19 static RawClass* CreateDummyClass(const String& class_name, 25 static RawClass* CreateDummyClass(const String& class_name,
20 const Script& script) { 26 const Script& script) {
21 const Class& cls = Class::Handle( 27 const Class& cls = Class::Handle(
22 Class::New(class_name, script, Scanner::kDummyTokenIndex)); 28 Class::New(class_name, script, Scanner::kDummyTokenIndex));
23 cls.set_is_synthesized_class(); // Dummy class for testing. 29 cls.set_is_synthesized_class(); // Dummy class for testing.
24 return cls.raw(); 30 return cls.raw();
25 } 31 }
26 32
27 33
28 TEST_CASE(Class) { 34 TEST_CASE(Class) {
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 EXPECT(str3.IsString()); 2394 EXPECT(str3.IsString());
2389 EXPECT(str3.IsOneByteString()); 2395 EXPECT(str3.IsOneByteString());
2390 str3 = OneByteString::null(); 2396 str3 = OneByteString::null();
2391 EXPECT(str3.IsString()); 2397 EXPECT(str3.IsString());
2392 EXPECT(!str3.IsOneByteString()); 2398 EXPECT(!str3.IsOneByteString());
2393 } 2399 }
2394 2400
2395 2401
2396 static Function* CreateFunction(const char* name) { 2402 static Function* CreateFunction(const char* name) {
2397 const String& class_name = String::Handle(Symbols::New("ownerClass")); 2403 const String& class_name = String::Handle(Symbols::New("ownerClass"));
2404 const String& lib_name = String::Handle(Symbols::New("ownerLibrary"));
2398 const Script& script = Script::Handle(); 2405 const Script& script = Script::Handle();
2399 const Class& owner_class = 2406 const Class& owner_class =
2400 Class::Handle(CreateDummyClass(class_name, script)); 2407 Class::Handle(CreateDummyClass(class_name, script));
2408 const Library& owner_library =
2409 Library::Handle(CreateDummyLibrary(lib_name));
2410 owner_class.set_library(owner_library);
2401 const String& function_name = String::ZoneHandle(Symbols::New(name)); 2411 const String& function_name = String::ZoneHandle(Symbols::New(name));
2402 Function& function = Function::ZoneHandle( 2412 Function& function = Function::ZoneHandle(
2403 Function::New(function_name, RawFunction::kRegularFunction, 2413 Function::New(function_name, RawFunction::kRegularFunction,
2404 true, false, false, false, owner_class, 0)); 2414 true, false, false, false, owner_class, 0));
2405 return &function; 2415 return &function;
2406 } 2416 }
2407 2417
2408 2418
2409 // Test for Code and Instruction object creation. 2419 // Test for Code and Instruction object creation.
2410 TEST_CASE(Code) { 2420 TEST_CASE(Code) {
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 cls = Object::dynamic_class(); 3580 cls = Object::dynamic_class();
3571 array = cls.fields(); 3581 array = cls.fields();
3572 EXPECT(!array.IsNull()); 3582 EXPECT(!array.IsNull());
3573 EXPECT(array.IsArray()); 3583 EXPECT(array.IsArray());
3574 array = cls.functions(); 3584 array = cls.functions();
3575 EXPECT(!array.IsNull()); 3585 EXPECT(!array.IsNull());
3576 EXPECT(array.IsArray()); 3586 EXPECT(array.IsArray());
3577 } 3587 }
3578 3588
3579 } // namespace dart 3589 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698