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

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

Issue 2104093003: DBC: Implement OneByteStringFromCharCode and StringToCharCode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT 5 #include <setjmp.h> // NOLINT
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_DBC) 9 #if defined(TARGET_ARCH_DBC)
10 10
(...skipping 10 matching lines...) Expand all
21 #include "vm/dart_entry.h" 21 #include "vm/dart_entry.h"
22 #include "vm/debugger.h" 22 #include "vm/debugger.h"
23 #include "vm/disassembler.h" 23 #include "vm/disassembler.h"
24 #include "vm/lockers.h" 24 #include "vm/lockers.h"
25 #include "vm/native_arguments.h" 25 #include "vm/native_arguments.h"
26 #include "vm/native_entry.h" 26 #include "vm/native_entry.h"
27 #include "vm/object.h" 27 #include "vm/object.h"
28 #include "vm/object_store.h" 28 #include "vm/object_store.h"
29 #include "vm/os_thread.h" 29 #include "vm/os_thread.h"
30 #include "vm/stack_frame.h" 30 #include "vm/stack_frame.h"
31 #include "vm/symbols.h"
31 32
32 namespace dart { 33 namespace dart {
33 34
34 DEFINE_FLAG(uint64_t, trace_sim_after, ULLONG_MAX, 35 DEFINE_FLAG(uint64_t, trace_sim_after, ULLONG_MAX,
35 "Trace simulator execution after instruction count reached."); 36 "Trace simulator execution after instruction count reached.");
36 DEFINE_FLAG(uint64_t, stop_sim_at, ULLONG_MAX, 37 DEFINE_FLAG(uint64_t, stop_sim_at, ULLONG_MAX,
37 "Instruction address or instruction count to stop simulator at."); 38 "Instruction address or instruction count to stop simulator at.");
38 39
39 // SimulatorSetjmpBuffer are linked together, and the last created one 40 // SimulatorSetjmpBuffer are linked together, and the last created one
40 // is referenced by the Simulator. When an exception is thrown, the exception 41 // is referenced by the Simulator. When an exception is thrown, the exception
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 SP[-0] = 0; // argc_tag is not smi tagged! 1519 SP[-0] = 0; // argc_tag is not smi tagged!
1519 SP[-1] = null_value; 1520 SP[-1] = null_value;
1520 Exit(thread, FP, SP + 1, pc); 1521 Exit(thread, FP, SP + 1, pc);
1521 NativeArguments args(thread, argc_tag, incoming_args, SP - 1); 1522 NativeArguments args(thread, argc_tag, incoming_args, SP - 1);
1522 INVOKE_NATIVE_WRAPPER(native_target, args); 1523 INVOKE_NATIVE_WRAPPER(native_target, args);
1523 SP -= 1; 1524 SP -= 1;
1524 DISPATCH(); 1525 DISPATCH();
1525 } 1526 }
1526 1527
1527 { 1528 {
1529 BYTECODE(OneByteStringFromCharCode, A_X);
1530 const intptr_t char_code = Smi::Value(RAW_CAST(Smi, FP[rD]));
1531 ASSERT(char_code >= 0);
1532 ASSERT(char_code <= 255);
1533 RawString** strings = Symbols::PredefinedAddress();
1534 const intptr_t index = char_code + Symbols::kNullCharCodeSymbolOffset;
1535 FP[rA] = strings[index];
1536 DISPATCH();
1537 }
1538
1539 {
1540 BYTECODE(StringToCharCode, A_X);
1541 RawOneByteString* str = RAW_CAST(OneByteString, FP[rD]);
1542 if (str->ptr()->length_ == Smi::New(1)) {
1543 FP[rA] = Smi::New(str->ptr()->data()[0]);
1544 } else {
1545 FP[rA] = Smi::New(-1);
1546 }
1547 DISPATCH();
1548 }
1549
1550 {
1528 BYTECODE(AddTOS, A_B_C); 1551 BYTECODE(AddTOS, A_B_C);
1529 SMI_FASTPATH_TOS(intptr_t, SignedAddWithOverflow); 1552 SMI_FASTPATH_TOS(intptr_t, SignedAddWithOverflow);
1530 DISPATCH(); 1553 DISPATCH();
1531 } 1554 }
1532 { 1555 {
1533 BYTECODE(SubTOS, A_B_C); 1556 BYTECODE(SubTOS, A_B_C);
1534 SMI_FASTPATH_TOS(intptr_t, SignedSubWithOverflow); 1557 SMI_FASTPATH_TOS(intptr_t, SignedSubWithOverflow);
1535 DISPATCH(); 1558 DISPATCH();
1536 } 1559 }
1537 { 1560 {
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 special_[kExceptionSpecialIndex] = raw_exception; 2380 special_[kExceptionSpecialIndex] = raw_exception;
2358 special_[kStacktraceSpecialIndex] = raw_stacktrace; 2381 special_[kStacktraceSpecialIndex] = raw_stacktrace;
2359 buf->Longjmp(); 2382 buf->Longjmp();
2360 UNREACHABLE(); 2383 UNREACHABLE();
2361 } 2384 }
2362 2385
2363 } // namespace dart 2386 } // namespace dart
2364 2387
2365 2388
2366 #endif // defined TARGET_ARCH_DBC 2389 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698