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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2754933003: [string] Optimize ToDirectStringAssembler for sequential strings (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 3356
3357 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) { 3357 Node* ToDirectStringAssembler::TryToDirect(Label* if_bailout) {
3358 VariableList vars({&var_string_, &var_offset_, &var_instance_type_}, zone()); 3358 VariableList vars({&var_string_, &var_offset_, &var_instance_type_}, zone());
3359 Label dispatch(this, vars); 3359 Label dispatch(this, vars);
3360 Label if_iscons(this); 3360 Label if_iscons(this);
3361 Label if_isexternal(this); 3361 Label if_isexternal(this);
3362 Label if_issliced(this); 3362 Label if_issliced(this);
3363 Label if_isthin(this); 3363 Label if_isthin(this);
3364 Label out(this); 3364 Label out(this);
3365 3365
3366 Goto(&dispatch); 3366 Branch(IsSequentialStringInstanceType(var_instance_type_.value()), &out,
3367 &dispatch);
3367 3368
3368 // Dispatch based on string representation. 3369 // Dispatch based on string representation.
3369 Bind(&dispatch); 3370 Bind(&dispatch);
3370 { 3371 {
3371 int32_t values[] = { 3372 int32_t values[] = {
3372 kSeqStringTag, kConsStringTag, kExternalStringTag, 3373 kSeqStringTag, kConsStringTag, kExternalStringTag,
3373 kSlicedStringTag, kThinStringTag, 3374 kSlicedStringTag, kThinStringTag,
3374 }; 3375 };
3375 Label* labels[] = { 3376 Label* labels[] = {
3376 &out, &if_iscons, &if_isexternal, &if_issliced, &if_isthin, 3377 &out, &if_iscons, &if_isexternal, &if_issliced, &if_isthin,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 3434
3434 Bind(&out); 3435 Bind(&out);
3435 return var_string_.value(); 3436 return var_string_.value();
3436 } 3437 }
3437 3438
3438 Node* ToDirectStringAssembler::TryToSequential(StringPointerKind ptr_kind, 3439 Node* ToDirectStringAssembler::TryToSequential(StringPointerKind ptr_kind,
3439 Label* if_bailout) { 3440 Label* if_bailout) {
3440 CHECK(ptr_kind == PTR_TO_DATA || ptr_kind == PTR_TO_STRING); 3441 CHECK(ptr_kind == PTR_TO_DATA || ptr_kind == PTR_TO_STRING);
3441 3442
3442 Variable var_result(this, MachineType::PointerRepresentation()); 3443 Variable var_result(this, MachineType::PointerRepresentation());
3443 Label out(this), if_issequential(this), if_isexternal(this); 3444 Label out(this), if_issequential(this), if_isexternal(this, Label::kDeferred);
3444 Branch(is_external(), &if_isexternal, &if_issequential); 3445 Branch(is_external(), &if_isexternal, &if_issequential);
3445 3446
3446 Bind(&if_issequential); 3447 Bind(&if_issequential);
3447 { 3448 {
3448 STATIC_ASSERT(SeqOneByteString::kHeaderSize == 3449 STATIC_ASSERT(SeqOneByteString::kHeaderSize ==
3449 SeqTwoByteString::kHeaderSize); 3450 SeqTwoByteString::kHeaderSize);
3450 Node* result = BitcastTaggedToWord(var_string_.value()); 3451 Node* result = BitcastTaggedToWord(var_string_.value());
3451 if (ptr_kind == PTR_TO_DATA) { 3452 if (ptr_kind == PTR_TO_DATA) {
3452 result = IntPtrAdd(result, IntPtrConstant(SeqOneByteString::kHeaderSize - 3453 result = IntPtrAdd(result, IntPtrConstant(SeqOneByteString::kHeaderSize -
3453 kHeapObjectTag)); 3454 kHeapObjectTag));
(...skipping 4818 matching lines...) Expand 10 before | Expand all | Expand 10 after
8272 formatted.c_str(), TENURED); 8273 formatted.c_str(), TENURED);
8273 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), 8274 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
8274 HeapConstant(string)); 8275 HeapConstant(string));
8275 } 8276 }
8276 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); 8277 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value);
8277 #endif 8278 #endif
8278 } 8279 }
8279 8280
8280 } // namespace internal 8281 } // namespace internal
8281 } // namespace v8 8282 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698