Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 7362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7373 jsobj.AddProperty("_guardLength", guarded_list_length()); | 7373 jsobj.AddProperty("_guardLength", guarded_list_length()); |
| 7374 } | 7374 } |
| 7375 const Class& origin_cls = Class::Handle(origin()); | 7375 const Class& origin_cls = Class::Handle(origin()); |
| 7376 const Script& script = Script::Handle(origin_cls.script()); | 7376 const Script& script = Script::Handle(origin_cls.script()); |
| 7377 if (!script.IsNull()) { | 7377 if (!script.IsNull()) { |
| 7378 jsobj.AddLocation(script, token_pos()); | 7378 jsobj.AddLocation(script, token_pos()); |
| 7379 } | 7379 } |
| 7380 } | 7380 } |
| 7381 | 7381 |
| 7382 | 7382 |
| 7383 RawInstance* Field::GetterClosure() const { | |
| 7384 ASSERT(is_static()); | |
| 7385 const Class& field_owner = Class::Handle(owner()); | |
| 7386 const char* field_name = String::Handle(name()).ToCString(); | |
| 7387 String& expr_src = String::Handle( | |
| 7388 String::NewFormatted("() { return %s; }", field_name)); | |
| 7389 Object& result = | |
| 7390 Object::Handle(field_owner.Evaluate(expr_src, | |
|
Florian Schneider
2015/07/17 09:42:02
With precompilation we can't invoke the compiler a
hausner
2015/07/17 17:53:51
Yes. This evaluation happens at (pre-)compile time
| |
| 7391 Object::empty_array(), | |
| 7392 Object::empty_array())); | |
| 7393 ASSERT(result.IsInstance()); | |
| 7394 result = Object::Clone(result, Heap::kOld); | |
|
Ivan Posva
2015/07/17 08:35:42
Why is this necessary?
hausner
2015/07/17 17:53:51
Because the result will be stuck into a LiteralNod
| |
| 7395 return Instance::RawCast(result.raw()); | |
| 7396 } | |
| 7397 | |
| 7398 | |
| 7399 RawInstance* Field::SetterClosure() const { | |
| 7400 ASSERT(is_static()); | |
| 7401 const Class& field_owner = Class::Handle(owner()); | |
| 7402 const char* field_name = String::Handle(name()).ToCString(); | |
| 7403 // TODO(hausner): Ensure that parameter name does not hide field name. | |
| 7404 String& expr_src = String::Handle( | |
| 7405 String::NewFormatted("(xxx) { return %s = xxx; }", field_name)); | |
| 7406 Object& result = | |
| 7407 Object::Handle(field_owner.Evaluate(expr_src, | |
|
Florian Schneider
2015/07/17 09:42:02
Same issue here with precompiled code.
| |
| 7408 Object::empty_array(), | |
| 7409 Object::empty_array())); | |
| 7410 ASSERT(result.IsInstance()); | |
| 7411 result = Object::Clone(result, Heap::kOld); | |
| 7412 return Instance::RawCast(result.raw()); | |
| 7413 } | |
| 7414 | |
| 7415 | |
| 7383 RawArray* Field::dependent_code() const { | 7416 RawArray* Field::dependent_code() const { |
| 7384 return raw_ptr()->dependent_code_; | 7417 return raw_ptr()->dependent_code_; |
| 7385 } | 7418 } |
| 7386 | 7419 |
| 7387 | 7420 |
| 7388 void Field::set_dependent_code(const Array& array) const { | 7421 void Field::set_dependent_code(const Array& array) const { |
| 7389 StorePointer(&raw_ptr()->dependent_code_, array.raw()); | 7422 StorePointer(&raw_ptr()->dependent_code_, array.raw()); |
| 7390 } | 7423 } |
| 7391 | 7424 |
| 7392 | 7425 |
| (...skipping 13798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21191 return tag_label.ToCString(); | 21224 return tag_label.ToCString(); |
| 21192 } | 21225 } |
| 21193 | 21226 |
| 21194 | 21227 |
| 21195 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21228 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21196 Instance::PrintJSONImpl(stream, ref); | 21229 Instance::PrintJSONImpl(stream, ref); |
| 21197 } | 21230 } |
| 21198 | 21231 |
| 21199 | 21232 |
| 21200 } // namespace dart | 21233 } // namespace dart |
| OLD | NEW |