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

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

Issue 1201383002: Port irregexp bytecode compiler and interpreter from V8 r24065. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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 "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 20729 matching lines...) Expand 10 before | Expand all | Expand 10 after
20740 void JSRegExp::set_pattern(const String& pattern) const { 20740 void JSRegExp::set_pattern(const String& pattern) const {
20741 StorePointer(&raw_ptr()->pattern_, pattern.raw()); 20741 StorePointer(&raw_ptr()->pattern_, pattern.raw());
20742 } 20742 }
20743 20743
20744 20744
20745 void JSRegExp::set_function(intptr_t cid, const Function& value) const { 20745 void JSRegExp::set_function(intptr_t cid, const Function& value) const {
20746 StorePointer(FunctionAddr(cid), value.raw()); 20746 StorePointer(FunctionAddr(cid), value.raw());
20747 } 20747 }
20748 20748
20749 20749
20750 void JSRegExp::set_bytecode(bool is_one_byte, const TypedData& bytecode) const {
20751 if (is_one_byte) {
20752 StorePointer(&raw_ptr()->one_byte_bytecode_, bytecode.raw());
20753 } else {
20754 StorePointer(&raw_ptr()->two_byte_bytecode_, bytecode.raw());
20755 }
srdjan 2015/07/07 19:30:25 If you set one, do you want to make sure that the
rmacnak 2015/07/07 21:42:53 They can both be set if one tries to match the reg
20756 }
20757
20758
20750 void JSRegExp::set_num_bracket_expressions(intptr_t value) const { 20759 void JSRegExp::set_num_bracket_expressions(intptr_t value) const {
20751 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value)); 20760 StoreSmi(&raw_ptr()->num_bracket_expressions_, Smi::New(value));
20752 } 20761 }
20753 20762
20754 20763
20755 RawJSRegExp* JSRegExp::New(Heap::Space space) { 20764 RawJSRegExp* JSRegExp::New(Heap::Space space) {
20756 JSRegExp& result = JSRegExp::Handle(); 20765 JSRegExp& result = JSRegExp::Handle();
20757 { 20766 {
20758 RawObject* raw = Object::Allocate(JSRegExp::kClassId, 20767 RawObject* raw = Object::Allocate(JSRegExp::kClassId,
20759 JSRegExp::InstanceSize(), 20768 JSRegExp::InstanceSize(),
20760 space); 20769 space);
20761 NoSafepointScope no_safepoint; 20770 NoSafepointScope no_safepoint;
20762 result ^= raw; 20771 result ^= raw;
20763 result.set_type(kUnitialized); 20772 result.set_type(kUnitialized);
20764 result.set_flags(0); 20773 result.set_flags(0);
20774 result.set_num_registers(-1);
20765 } 20775 }
20766 return result.raw(); 20776 return result.raw();
20767 } 20777 }
20768 20778
20769 20779
20770 void* JSRegExp::GetDataStartAddress() const { 20780 void* JSRegExp::GetDataStartAddress() const {
20771 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr()); 20781 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr());
20772 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp)); 20782 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp));
20773 } 20783 }
20774 20784
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
21066 return tag_label.ToCString(); 21076 return tag_label.ToCString();
21067 } 21077 }
21068 21078
21069 21079
21070 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 21080 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
21071 Instance::PrintJSONImpl(stream, ref); 21081 Instance::PrintJSONImpl(stream, ref);
21072 } 21082 }
21073 21083
21074 21084
21075 } // namespace dart 21085 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | runtime/vm/regexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698