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

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

Issue 1315893004: Load runtime entries from the Thread instead of the ObjectPool. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/regexp_assembler_ir.h" 5 #include "vm/regexp_assembler_ir.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
11 #include "vm/il_printer.h" 11 #include "vm/il_printer.h"
12 #include "vm/object_store.h" 12 #include "vm/object_store.h"
13 #include "vm/regexp.h" 13 #include "vm/regexp.h"
14 #include "vm/resolver.h" 14 #include "vm/resolver.h"
15 #include "vm/runtime_entry.h"
15 #include "vm/stack_frame.h" 16 #include "vm/stack_frame.h"
16 #include "vm/unibrow-inl.h" 17 #include "vm/unibrow-inl.h"
17 #include "vm/unicode.h" 18 #include "vm/unicode.h"
18 19
19 #define Z zone() 20 #define Z zone()
20 21
21 // Debugging output macros. TAG() is called at the head of each interesting 22 // Debugging output macros. TAG() is called at the head of each interesting
22 // function and prints its name during execution if irregexp tracing is enabled. 23 // function and prints its name during execution if irregexp tracing is enabled.
23 #define TAG() if (FLAG_trace_irregexp) { TAG_(); } 24 #define TAG() if (FLAG_trace_irregexp) { TAG_(); }
24 #define TAG_() \ 25 #define TAG_() \
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 329
329 if (retval.IsNull()) { 330 if (retval.IsNull()) {
330 return Array::null(); 331 return Array::null();
331 } 332 }
332 333
333 ASSERT(retval.IsArray()); 334 ASSERT(retval.IsArray());
334 return Array::Cast(retval).raw(); 335 return Array::Cast(retval).raw();
335 } 336 }
336 337
337 338
338 RawBool* IRRegExpMacroAssembler::CaseInsensitiveCompareUC16( 339 static RawBool* CaseInsensitiveCompareUC16(RawString* str_raw,
339 RawString* str_raw, 340 RawSmi* lhs_index_raw,
340 RawSmi* lhs_index_raw, 341 RawSmi* rhs_index_raw,
341 RawSmi* rhs_index_raw, 342 RawSmi* length_raw) {
342 RawSmi* length_raw) {
343 const String& str = String::Handle(str_raw); 343 const String& str = String::Handle(str_raw);
344 const Smi& lhs_index = Smi::Handle(lhs_index_raw); 344 const Smi& lhs_index = Smi::Handle(lhs_index_raw);
345 const Smi& rhs_index = Smi::Handle(rhs_index_raw); 345 const Smi& rhs_index = Smi::Handle(rhs_index_raw);
346 const Smi& length = Smi::Handle(length_raw); 346 const Smi& length = Smi::Handle(length_raw);
347 347
348 // TODO(zerny): Optimize as single instance. V8 has this as an 348 // TODO(zerny): Optimize as single instance. V8 has this as an
349 // isolate member. 349 // isolate member.
350 unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize; 350 unibrow::Mapping<unibrow::Ecma262Canonicalize> canonicalize;
351 351
352 for (intptr_t i = 0; i < length.Value(); i++) { 352 for (intptr_t i = 0; i < length.Value(); i++) {
353 int32_t c1 = str.CharAt(lhs_index.Value() + i); 353 int32_t c1 = str.CharAt(lhs_index.Value() + i);
354 int32_t c2 = str.CharAt(rhs_index.Value() + i); 354 int32_t c2 = str.CharAt(rhs_index.Value() + i);
355 if (c1 != c2) { 355 if (c1 != c2) {
356 int32_t s1[1] = { c1 }; 356 int32_t s1[1] = { c1 };
357 canonicalize.get(c1, '\0', s1); 357 canonicalize.get(c1, '\0', s1);
358 if (s1[0] != c2) { 358 if (s1[0] != c2) {
359 int32_t s2[1] = { c2 }; 359 int32_t s2[1] = { c2 };
360 canonicalize.get(c2, '\0', s2); 360 canonicalize.get(c2, '\0', s2);
361 if (s1[0] != s2[0]) { 361 if (s1[0] != s2[0]) {
362 return Bool::False().raw(); 362 return Bool::False().raw();
363 } 363 }
364 } 364 }
365 } 365 }
366 } 366 }
367 return Bool::True().raw(); 367 return Bool::True().raw();
368 } 368 }
369 369
370 370
371 DEFINE_RAW_LEAF_RUNTIME_ENTRY(
372 CaseInsensitiveCompareUC16, 4, false /* is_float */,
373 reinterpret_cast<RuntimeFunction>(&CaseInsensitiveCompareUC16));
374
375
371 LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name, 376 LocalVariable* IRRegExpMacroAssembler::Parameter(const String& name,
372 intptr_t index) const { 377 intptr_t index) const {
373 const Type& local_type = Type::ZoneHandle(Z, Type::DynamicType()); 378 const Type& local_type = Type::ZoneHandle(Z, Type::DynamicType());
374 LocalVariable* local = 379 LocalVariable* local =
375 new(Z) LocalVariable(kNoSourcePos, name, local_type); 380 new(Z) LocalVariable(kNoSourcePos, name, local_type);
376 381
377 intptr_t param_frame_index = kParamEndSlotFromFp + kParamCount - index; 382 intptr_t param_frame_index = kParamEndSlotFromFp + kParamCount - index;
378 local->set_index(param_frame_index); 383 local->set_index(param_frame_index);
379 384
380 return local; 385 return local;
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 index_val, 1919 index_val,
1915 characters, 1920 characters,
1916 specialization_cid_, 1921 specialization_cid_,
1917 Scanner::kNoSourcePos)); 1922 Scanner::kNoSourcePos));
1918 } 1923 }
1919 1924
1920 1925
1921 #undef __ 1926 #undef __
1922 1927
1923 } // namespace dart 1928 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698