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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 4 years 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4
5 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 // and go to (1). Otherwise bail out to runtime. 1288 // and go to (1). Otherwise bail out to runtime.
1289 // (4) Sequential string. Load regexp code according to encoding. 1289 // (4) Sequential string. Load regexp code according to encoding.
1290 // (E) Carry on. 1290 // (E) Carry on.
1291 /// [...] 1291 /// [...]
1292 1292
1293 // Deferred code at the end of the stub: 1293 // Deferred code at the end of the stub:
1294 // (5) Long external string? If not, go to (7). 1294 // (5) Long external string? If not, go to (7).
1295 // (6) External string. Make it, offset-wise, look like a sequential string. 1295 // (6) External string. Make it, offset-wise, look like a sequential string.
1296 // Go to (4). 1296 // Go to (4).
1297 // (7) Short external string or not a string? If yes, bail out to runtime. 1297 // (7) Short external string or not a string? If yes, bail out to runtime.
1298 // (8) Sliced string. Replace subject with parent. Go to (1). 1298 // (8) Sliced or thin string. Replace subject with parent. Go to (1).
1299 1299
1300 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, 1300 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1301 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; 1301 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1302 1302
1303 __ bind(&check_underlying); 1303 __ bind(&check_underlying);
1304 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1304 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
1305 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); 1305 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset));
1306 1306
1307 // (1) Sequential string? If yes, go to (4). 1307 // (1) Sequential string? If yes, go to (4).
1308 __ and_(r1, 1308 __ and_(r1,
(...skipping 28 matching lines...) Expand all
1337 // Load previous index and check range before r3 is overwritten. We have to 1337 // Load previous index and check range before r3 is overwritten. We have to
1338 // use r3 instead of subject here because subject might have been only made 1338 // use r3 instead of subject here because subject might have been only made
1339 // to look like a sequential string when it actually is an external string. 1339 // to look like a sequential string when it actually is an external string.
1340 __ ldr(r1, MemOperand(sp, kPreviousIndexOffset)); 1340 __ ldr(r1, MemOperand(sp, kPreviousIndexOffset));
1341 __ JumpIfNotSmi(r1, &runtime); 1341 __ JumpIfNotSmi(r1, &runtime);
1342 __ ldr(r3, FieldMemOperand(r3, String::kLengthOffset)); 1342 __ ldr(r3, FieldMemOperand(r3, String::kLengthOffset));
1343 __ cmp(r3, Operand(r1)); 1343 __ cmp(r3, Operand(r1));
1344 __ b(ls, &runtime); 1344 __ b(ls, &runtime);
1345 __ SmiUntag(r1); 1345 __ SmiUntag(r1);
1346 1346
1347 STATIC_ASSERT(4 == kOneByteStringTag); 1347 STATIC_ASSERT(8 == kOneByteStringTag);
1348 STATIC_ASSERT(kTwoByteStringTag == 0); 1348 STATIC_ASSERT(kTwoByteStringTag == 0);
1349 __ and_(r0, r0, Operand(kStringEncodingMask)); 1349 __ and_(r0, r0, Operand(kStringEncodingMask));
1350 __ mov(r3, Operand(r0, ASR, 2), SetCC); 1350 __ mov(r3, Operand(r0, ASR, 3), SetCC);
1351 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset), 1351 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset),
1352 ne); 1352 ne);
1353 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); 1353 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq);
1354 1354
1355 // (E) Carry on. String handling is done. 1355 // (E) Carry on. String handling is done.
1356 // r6: irregexp code 1356 // r6: irregexp code
1357 // Check that the irregexp code has been generated for the actual string 1357 // Check that the irregexp code has been generated for the actual string
1358 // encoding. If it has, the field contains a code object otherwise it contains 1358 // encoding. If it has, the field contains a code object otherwise it contains
1359 // a smi (code flushing support). 1359 // a smi (code flushing support).
1360 __ JumpIfSmi(r6, &runtime); 1360 __ JumpIfSmi(r6, &runtime);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 subject, 1574 subject,
1575 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); 1575 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
1576 __ jmp(&seq_string); // Go to (4). 1576 __ jmp(&seq_string); // Go to (4).
1577 1577
1578 // (7) Short external string or not a string? If yes, bail out to runtime. 1578 // (7) Short external string or not a string? If yes, bail out to runtime.
1579 __ bind(&not_long_external); 1579 __ bind(&not_long_external);
1580 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 1580 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
1581 __ tst(r1, Operand(kIsNotStringMask | kShortExternalStringMask)); 1581 __ tst(r1, Operand(kIsNotStringMask | kShortExternalStringMask));
1582 __ b(ne, &runtime); 1582 __ b(ne, &runtime);
1583 1583
1584 // (8) Sliced string. Replace subject with parent. Go to (4). 1584 // (8) Sliced or thin string. Replace subject with parent. Go to (4).
1585 Label thin_string;
1586 __ cmp(r1, Operand(kThinStringTag));
1587 __ b(eq, &thin_string);
1585 // Load offset into r9 and replace subject string with parent. 1588 // Load offset into r9 and replace subject string with parent.
1586 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1589 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1587 __ SmiUntag(r9); 1590 __ SmiUntag(r9);
1588 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1591 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1589 __ jmp(&check_underlying); // Go to (4). 1592 __ jmp(&check_underlying); // Go to (4).
1593
1594 __ bind(&thin_string);
1595 __ ldr(subject, FieldMemOperand(subject, ThinString::kActualOffset));
1596 __ jmp(&check_underlying); // Go to (4).
1590 #endif // V8_INTERPRETED_REGEXP 1597 #endif // V8_INTERPRETED_REGEXP
1591 } 1598 }
1592 1599
1593 1600
1594 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1601 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1595 // r0 : number of arguments to the construct function 1602 // r0 : number of arguments to the construct function
1596 // r1 : the function to call 1603 // r1 : the function to call
1597 // r2 : feedback vector 1604 // r2 : feedback vector
1598 // r3 : slot in feedback vector (Smi) 1605 // r3 : slot in feedback vector (Smi)
1599 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1606 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after
4318 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4325 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4319 kStackUnwindSpace, NULL, return_value_operand, NULL); 4326 kStackUnwindSpace, NULL, return_value_operand, NULL);
4320 } 4327 }
4321 4328
4322 #undef __ 4329 #undef __
4323 4330
4324 } // namespace internal 4331 } // namespace internal
4325 } // namespace v8 4332 } // namespace v8
4326 4333
4327 #endif // V8_TARGET_ARCH_ARM 4334 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/codegen-arm.cc » ('j') | src/code-stub-assembler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698