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

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

Issue 668193002: Remove isolate pointer from context objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 | « runtime/vm/object.cc ('k') | runtime/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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 EXPECT_EQ(-1, last_idx); 2393 EXPECT_EQ(-1, last_idx);
2394 script.TokenRangeAtLine(1000, &first_idx, &last_idx); 2394 script.TokenRangeAtLine(1000, &first_idx, &last_idx);
2395 EXPECT_EQ(-1, first_idx); 2395 EXPECT_EQ(-1, first_idx);
2396 EXPECT_EQ(-1, last_idx); 2396 EXPECT_EQ(-1, last_idx);
2397 } 2397 }
2398 2398
2399 2399
2400 TEST_CASE(Context) { 2400 TEST_CASE(Context) {
2401 const int kNumVariables = 5; 2401 const int kNumVariables = 5;
2402 const Context& parent_context = Context::Handle(Context::New(0)); 2402 const Context& parent_context = Context::Handle(Context::New(0));
2403 EXPECT_EQ(parent_context.isolate(), Isolate::Current());
2404 const Context& context = Context::Handle(Context::New(kNumVariables)); 2403 const Context& context = Context::Handle(Context::New(kNumVariables));
2405 context.set_parent(parent_context); 2404 context.set_parent(parent_context);
2406 const Context& check_parent_context = Context::Handle(context.parent());
2407 EXPECT_EQ(context.isolate(), check_parent_context.isolate());
2408 EXPECT_EQ(kNumVariables, context.num_variables()); 2405 EXPECT_EQ(kNumVariables, context.num_variables());
2409 EXPECT(Context::Handle(context.parent()).raw() == parent_context.raw()); 2406 EXPECT(Context::Handle(context.parent()).raw() == parent_context.raw());
2410 EXPECT_EQ(0, Context::Handle(context.parent()).num_variables()); 2407 EXPECT_EQ(0, Context::Handle(context.parent()).num_variables());
2411 EXPECT(Context::Handle(Context::Handle(context.parent()).parent()).IsNull()); 2408 EXPECT(Context::Handle(Context::Handle(context.parent()).parent()).IsNull());
2412 Object& variable = Object::Handle(context.At(0)); 2409 Object& variable = Object::Handle(context.At(0));
2413 EXPECT(variable.IsNull()); 2410 EXPECT(variable.IsNull());
2414 variable = context.At(kNumVariables - 1); 2411 variable = context.At(kNumVariables - 1);
2415 EXPECT(variable.IsNull()); 2412 EXPECT(variable.IsNull());
2416 context.SetAt(0, Smi::Handle(Smi::New(2))); 2413 context.SetAt(0, Smi::Handle(Smi::New(2)));
2417 context.SetAt(2, Smi::Handle(Smi::New(3))); 2414 context.SetAt(2, Smi::Handle(Smi::New(3)));
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 EXPECT_VALID(h_result); 4468 EXPECT_VALID(h_result);
4472 Integer& result = Integer::Handle(); 4469 Integer& result = Integer::Handle();
4473 result ^= Api::UnwrapHandle(h_result); 4470 result ^= Api::UnwrapHandle(h_result);
4474 String& foo = String::Handle(String::New("foo")); 4471 String& foo = String::Handle(String::New("foo"));
4475 Integer& expected = Integer::Handle(); 4472 Integer& expected = Integer::Handle();
4476 expected ^= foo.HashCode(); 4473 expected ^= foo.HashCode();
4477 EXPECT(result.IsIdenticalTo(expected)); 4474 EXPECT(result.IsIdenticalTo(expected));
4478 } 4475 }
4479 4476
4480 } // namespace dart 4477 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698