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 20328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20339 void JSRegExp::set_function(intptr_t cid, const Function& value) const { | 20339 void JSRegExp::set_function(intptr_t cid, const Function& value) const { |
20340 StorePointer(FunctionAddr(cid), value.raw()); | 20340 StorePointer(FunctionAddr(cid), value.raw()); |
20341 } | 20341 } |
20342 | 20342 |
20343 | 20343 |
20344 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { | 20344 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { |
20345 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); | 20345 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); |
20346 } | 20346 } |
20347 | 20347 |
20348 | 20348 |
20349 RawJSRegExp* JSRegExp::New(intptr_t len, Heap::Space space) { | 20349 RawJSRegExp* JSRegExp::New(Heap::Space space) { |
20350 if (len < 0 || len > kMaxElements) { | |
20351 // This should be caught before we reach here. | |
20352 FATAL1("Fatal error in JSRegexp::New: invalid len %" Pd "\n", len); | |
20353 } | |
20354 JSRegExp& result = JSRegExp::Handle(); | 20350 JSRegExp& result = JSRegExp::Handle(); |
20355 { | 20351 { |
20356 RawObject* raw = Object::Allocate(JSRegExp::kClassId, | 20352 RawObject* raw = Object::Allocate(JSRegExp::kClassId, |
20357 JSRegExp::InstanceSize(len), | 20353 JSRegExp::InstanceSize(), |
20358 space); | 20354 space); |
20359 NoSafepointScope no_safepoint; | 20355 NoSafepointScope no_safepoint; |
20360 result ^= raw; | 20356 result ^= raw; |
20361 result.set_type(kUnitialized); | 20357 result.set_type(kUnitialized); |
20362 result.set_flags(0); | 20358 result.set_flags(0); |
20363 result.SetLength(len); | |
20364 } | 20359 } |
20365 return result.raw(); | 20360 return result.raw(); |
20366 } | 20361 } |
20367 | 20362 |
20368 | 20363 |
20369 void* JSRegExp::GetDataStartAddress() const { | 20364 void* JSRegExp::GetDataStartAddress() const { |
20370 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr()); | 20365 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr()); |
20371 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp)); | 20366 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp)); |
20372 } | 20367 } |
20373 | 20368 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20670 return tag_label.ToCString(); | 20665 return tag_label.ToCString(); |
20671 } | 20666 } |
20672 | 20667 |
20673 | 20668 |
20674 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20669 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20675 Instance::PrintJSONImpl(stream, ref); | 20670 Instance::PrintJSONImpl(stream, ref); |
20676 } | 20671 } |
20677 | 20672 |
20678 | 20673 |
20679 } // namespace dart | 20674 } // namespace dart |
OLD | NEW |