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

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

Issue 8528010: Changes to pass the current isolate to all runtime and native calls. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/allocation.cc ('k') | runtime/vm/code_generator.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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/allocation.h" 5 #include "vm/allocation.h"
6 #include "vm/assert.h" 6 #include "vm/assert.h"
7 #include "vm/longjump.h" 7 #include "vm/longjump.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 13 matching lines...) Expand all
24 int value() const { return *ptr_; } 24 int value() const { return *ptr_; }
25 virtual int GetId() const { return 3; } 25 virtual int GetId() const { return 3; }
26 26
27 private: 27 private:
28 int* ptr_; 28 int* ptr_;
29 }; 29 };
30 30
31 31
32 class TestStackResource : public StackResource { 32 class TestStackResource : public StackResource {
33 public: 33 public:
34 explicit TestStackResource(int* ptr) : ptr_(ptr) { 34 explicit TestStackResource(int* ptr)
35 : StackResource(Isolate::Current()), ptr_(ptr) {
35 EXPECT_EQ(1, *ptr_); 36 EXPECT_EQ(1, *ptr_);
36 *ptr_ = 2; 37 *ptr_ = 2;
37 } 38 }
38 39
39 ~TestStackResource() { 40 ~TestStackResource() {
40 EXPECT_EQ(6, *ptr_); 41 EXPECT_EQ(6, *ptr_);
41 *ptr_ = 7; 42 *ptr_ = 7;
42 } 43 }
43 44
44 int value() const { return *ptr_; } 45 int value() const { return *ptr_; }
45 virtual int GetId() const { return 3; } 46 virtual int GetId() const { return 3; }
46 47
47 private: 48 private:
48 int* ptr_; 49 int* ptr_;
49 }; 50 };
50 51
51 52
52 class TestStackedStackResource : public StackResource { 53 class TestStackedStackResource : public StackResource {
53 public: 54 public:
54 explicit TestStackedStackResource(int* ptr) : ptr_(ptr) { 55 explicit TestStackedStackResource(int* ptr)
56 : StackResource(Isolate::Current()), ptr_(ptr) {
55 EXPECT_EQ(3, *ptr_); 57 EXPECT_EQ(3, *ptr_);
56 *ptr_ = 4; 58 *ptr_ = 4;
57 } 59 }
58 60
59 ~TestStackedStackResource() { 61 ~TestStackedStackResource() {
60 EXPECT_EQ(5, *ptr_); 62 EXPECT_EQ(5, *ptr_);
61 *ptr_ = 6; 63 *ptr_ = 6;
62 } 64 }
63 65
64 int value() const { return *ptr_; } 66 int value() const { return *ptr_; }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 LongJump jump; 150 LongJump jump;
149 int data = 1; 151 int data = 1;
150 if (setjmp(*jump.Set()) == 0) { 152 if (setjmp(*jump.Set()) == 0) {
151 StackResourceLongJumpHelper(&data, &jump); 153 StackResourceLongJumpHelper(&data, &jump);
152 UNREACHABLE(); 154 UNREACHABLE();
153 } 155 }
154 EXPECT_EQ(7, data); 156 EXPECT_EQ(7, data);
155 } 157 }
156 158
157 } // namespace dart 159 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/allocation.cc ('k') | runtime/vm/code_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698