OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 #include "src/vm/program.h" | 5 #include "src/vm/program.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "src/shared/assert.h" | 10 #include "src/shared/assert.h" |
11 #include "src/shared/flags.h" | 11 #include "src/shared/flags.h" |
12 #include "src/shared/globals.h" | 12 #include "src/shared/globals.h" |
13 #include "src/shared/names.h" | 13 #include "src/shared/names.h" |
14 #include "src/shared/platform.h" | 14 #include "src/shared/platform.h" |
15 #include "src/shared/selectors.h" | 15 #include "src/shared/selectors.h" |
16 #include "src/shared/utils.h" | 16 #include "src/shared/utils.h" |
17 | 17 |
18 #include "src/vm/frame.h" | 18 #include "src/vm/frame.h" |
19 #include "src/vm/heap_validator.h" | 19 #include "src/vm/heap_validator.h" |
20 #include "src/vm/mark_sweep.h" | 20 #include "src/vm/mark_sweep.h" |
21 #include "src/vm/native_interpreter.h" | 21 #include "src/vm/native_interpreter.h" |
22 #include "src/vm/object.h" | 22 #include "src/vm/object.h" |
23 #include "src/vm/port.h" | 23 #include "src/vm/port.h" |
24 #include "src/vm/process.h" | 24 #include "src/vm/process.h" |
25 #include "src/vm/session.h" | 25 #include "src/vm/session.h" |
26 | 26 |
27 namespace fletch { | 27 namespace dartino { |
28 | 28 |
29 static List<const char> StringFromCharZ(const char* str) { | 29 static List<const char> StringFromCharZ(const char* str) { |
30 return List<const char>(str, strlen(str)); | 30 return List<const char>(str, strlen(str)); |
31 } | 31 } |
32 | 32 |
33 void ProgramState::AddPausedProcess(Process* process) { | 33 void ProgramState::AddPausedProcess(Process* process) { |
34 ASSERT(process->next() == NULL); | 34 ASSERT(process->next() == NULL); |
35 process->set_next(paused_processes_head_); | 35 process->set_next(paused_processes_head_); |
36 set_paused_processes_head(process); | 36 set_paused_processes_head(process); |
37 ASSERT(paused_processes_head_ != paused_processes_head_->next()); | 37 ASSERT(paused_processes_head_ != paused_processes_head_->next()); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 Object* Program::CreateClass(int fields) { | 191 Object* Program::CreateClass(int fields) { |
192 InstanceFormat format = InstanceFormat::instance_format(fields); | 192 InstanceFormat format = InstanceFormat::instance_format(fields); |
193 Object* raw_class = heap()->CreateClass(format, meta_class(), null_object()); | 193 Object* raw_class = heap()->CreateClass(format, meta_class(), null_object()); |
194 if (raw_class->IsFailure()) return raw_class; | 194 if (raw_class->IsFailure()) return raw_class; |
195 Class* klass = Class::cast(raw_class); | 195 Class* klass = Class::cast(raw_class); |
196 ASSERT(klass->NumberOfInstanceFields() == fields); | 196 ASSERT(klass->NumberOfInstanceFields() == fields); |
197 return klass; | 197 return klass; |
198 } | 198 } |
199 | 199 |
200 Object* Program::CreateDouble(fletch_double value) { | 200 Object* Program::CreateDouble(dartino_double value) { |
201 return heap()->CreateDouble(double_class(), value); | 201 return heap()->CreateDouble(double_class(), value); |
202 } | 202 } |
203 | 203 |
204 Object* Program::CreateFunction(int arity, List<uint8> bytes, | 204 Object* Program::CreateFunction(int arity, List<uint8> bytes, |
205 int number_of_literals) { | 205 int number_of_literals) { |
206 return heap()->CreateFunction(function_class(), arity, bytes, | 206 return heap()->CreateFunction(function_class(), arity, bytes, |
207 number_of_literals); | 207 number_of_literals); |
208 } | 208 } |
209 | 209 |
210 Object* Program::CreateLargeInteger(int64 value) { | 210 Object* Program::CreateLargeInteger(int64 value) { |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 cooked_stack_deltas_.Delete(); | 1167 cooked_stack_deltas_.Delete(); |
1168 stack_chain_ = NULL; | 1168 stack_chain_ = NULL; |
1169 } | 1169 } |
1170 | 1170 |
1171 LookupCache* Program::EnsureCache() { | 1171 LookupCache* Program::EnsureCache() { |
1172 if (cache_ == NULL) cache_ = new LookupCache(); | 1172 if (cache_ == NULL) cache_ = new LookupCache(); |
1173 return cache_; | 1173 return cache_; |
1174 } | 1174 } |
1175 | 1175 |
1176 | 1176 |
1177 } // namespace fletch | 1177 } // namespace dartino |
OLD | NEW |