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

Unified Diff: src/x87/codegen-x87.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: rebased Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x87/code-stubs-x87.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x87/codegen-x87.cc
diff --git a/src/x87/codegen-x87.cc b/src/x87/codegen-x87.cc
index a2bba1dcd7c565c0544a8f6d6a3903fddefb1d06..92259350cbb6cb006fd1a2c6ba9ca9a03b013035 100644
--- a/src/x87/codegen-x87.cc
+++ b/src/x87/codegen-x87.cc
@@ -218,6 +218,9 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
Register index,
Register result,
Label* call_runtime) {
+ Label indirect_string_loaded;
+ __ bind(&indirect_string_loaded);
+
// Fetch the instance type of the receiver into result register.
__ mov(result, FieldOperand(string, HeapObject::kMapOffset));
__ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset));
@@ -228,17 +231,24 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
__ j(zero, &check_sequential, Label::kNear);
// Dispatch on the indirect string shape: slice or cons.
- Label cons_string;
- __ test(result, Immediate(kSlicedNotConsMask));
- __ j(zero, &cons_string, Label::kNear);
+ Label cons_string, thin_string;
+ __ and_(result, Immediate(kStringRepresentationMask));
+ __ cmp(result, Immediate(kConsStringTag));
+ __ j(equal, &cons_string, Label::kNear);
+ __ cmp(result, Immediate(kThinStringTag));
+ __ j(equal, &thin_string, Label::kNear);
// Handle slices.
- Label indirect_string_loaded;
__ mov(result, FieldOperand(string, SlicedString::kOffsetOffset));
__ SmiUntag(result);
__ add(index, result);
__ mov(string, FieldOperand(string, SlicedString::kParentOffset));
- __ jmp(&indirect_string_loaded, Label::kNear);
+ __ jmp(&indirect_string_loaded);
+
+ // Handle thin strings.
+ __ bind(&thin_string);
+ __ mov(string, FieldOperand(string, ThinString::kActualOffset));
+ __ jmp(&indirect_string_loaded);
// Handle cons strings.
// Check whether the right hand side is the empty string (i.e. if
@@ -250,10 +260,7 @@ void StringCharLoadGenerator::Generate(MacroAssembler* masm,
Immediate(factory->empty_string()));
__ j(not_equal, call_runtime);
__ mov(string, FieldOperand(string, ConsString::kFirstOffset));
-
- __ bind(&indirect_string_loaded);
- __ mov(result, FieldOperand(string, HeapObject::kMapOffset));
- __ movzx_b(result, FieldOperand(result, Map::kInstanceTypeOffset));
+ __ jmp(&indirect_string_loaded);
// Distinguish sequential and external strings. Only these two string
// representations can reach here (slices and flat cons strings have been
« no previous file with comments | « src/x87/code-stubs-x87.cc ('k') | src/x87/macro-assembler-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698