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

Side by Side Diff: vm/object_test.cc

Issue 11087070: - Get rid of RawClosure class and use RawInstance for closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object.h » ('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/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 parent = Function::New(parent_name, RawFunction::kRegularFunction, 2331 parent = Function::New(parent_name, RawFunction::kRegularFunction,
2332 false, false, false, false, cls, 0); 2332 false, false, false, false, cls, 0);
2333 functions.SetAt(0, parent); 2333 functions.SetAt(0, parent);
2334 cls.SetFunctions(functions); 2334 cls.SetFunctions(functions);
2335 2335
2336 Function& function = Function::Handle(); 2336 Function& function = Function::Handle();
2337 const String& function_name = String::Handle(Symbols::New("foo")); 2337 const String& function_name = String::Handle(Symbols::New("foo"));
2338 function = Function::NewClosureFunction(function_name, parent, 0); 2338 function = Function::NewClosureFunction(function_name, parent, 0);
2339 const Class& signature_class = Class::Handle( 2339 const Class& signature_class = Class::Handle(
2340 Class::NewSignatureClass(function_name, function, script)); 2340 Class::NewSignatureClass(function_name, function, script));
2341 const Closure& closure = Closure::Handle(Closure::New(function, context)); 2341 const Instance& closure = Instance::Handle(Closure::New(function, context));
2342 const Class& closure_class = Class::Handle(closure.clazz()); 2342 const Class& closure_class = Class::Handle(closure.clazz());
2343 EXPECT(closure_class.IsSignatureClass()); 2343 EXPECT(closure_class.IsSignatureClass());
2344 EXPECT(closure_class.IsCanonicalSignatureClass()); 2344 EXPECT(closure_class.IsCanonicalSignatureClass());
2345 EXPECT_EQ(closure_class.raw(), signature_class.raw()); 2345 EXPECT_EQ(closure_class.raw(), signature_class.raw());
2346 const Function& signature_function = 2346 const Function& signature_function =
2347 Function::Handle(signature_class.signature_function()); 2347 Function::Handle(signature_class.signature_function());
2348 EXPECT_EQ(signature_function.raw(), function.raw()); 2348 EXPECT_EQ(signature_function.raw(), function.raw());
2349 const Context& closure_context = Context::Handle(closure.context()); 2349 const Context& closure_context = Context::Handle(Closure::context(closure));
2350 EXPECT_EQ(closure_context.raw(), closure_context.raw()); 2350 EXPECT_EQ(closure_context.raw(), closure_context.raw());
2351 } 2351 }
2352 2352
2353 2353
2354 TEST_CASE(ObjectPrinting) { 2354 TEST_CASE(ObjectPrinting) {
2355 // Simple Smis. 2355 // Simple Smis.
2356 EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString()); 2356 EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString());
2357 EXPECT_STREQ("-15", Smi::Handle(Smi::New(-15)).ToCString()); 2357 EXPECT_STREQ("-15", Smi::Handle(Smi::New(-15)).ToCString());
2358 2358
2359 // bool class and true/false values. 2359 // bool class and true/false values.
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 isolate->heap()->CollectAllGarbage(); 3243 isolate->heap()->CollectAllGarbage();
3244 EXPECT(weak1.key() == Object::null()); 3244 EXPECT(weak1.key() == Object::null());
3245 EXPECT(weak1.value() == Object::null()); 3245 EXPECT(weak1.value() == Object::null());
3246 EXPECT(weak2.key() == Object::null()); 3246 EXPECT(weak2.key() == Object::null());
3247 EXPECT(weak2.value() == Object::null()); 3247 EXPECT(weak2.value() == Object::null());
3248 } 3248 }
3249 3249
3250 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3250 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3251 3251
3252 } // namespace dart 3252 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698