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

Side by Side Diff: src/arm/code-stubs-arm.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 unified diff | Download patch
« no previous file with comments | « include/v8.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 // and go to (1). Otherwise bail out to runtime. 1290 // and go to (1). Otherwise bail out to runtime.
1291 // (4) Sequential string. Load regexp code according to encoding. 1291 // (4) Sequential string. Load regexp code according to encoding.
1292 // (E) Carry on. 1292 // (E) Carry on.
1293 /// [...] 1293 /// [...]
1294 1294
1295 // Deferred code at the end of the stub: 1295 // Deferred code at the end of the stub:
1296 // (5) Long external string? If not, go to (7). 1296 // (5) Long external string? If not, go to (7).
1297 // (6) External string. Make it, offset-wise, look like a sequential string. 1297 // (6) External string. Make it, offset-wise, look like a sequential string.
1298 // Go to (4). 1298 // Go to (4).
1299 // (7) Short external string or not a string? If yes, bail out to runtime. 1299 // (7) Short external string or not a string? If yes, bail out to runtime.
1300 // (8) Sliced string. Replace subject with parent. Go to (1). 1300 // (8) Sliced or thin string. Replace subject with parent. Go to (1).
1301 1301
1302 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */, 1302 Label seq_string /* 4 */, external_string /* 6 */, check_underlying /* 1 */,
1303 not_seq_nor_cons /* 5 */, not_long_external /* 7 */; 1303 not_seq_nor_cons /* 5 */, not_long_external /* 7 */;
1304 1304
1305 __ bind(&check_underlying); 1305 __ bind(&check_underlying);
1306 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset)); 1306 __ ldr(r0, FieldMemOperand(subject, HeapObject::kMapOffset));
1307 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset)); 1307 __ ldrb(r0, FieldMemOperand(r0, Map::kInstanceTypeOffset));
1308 1308
1309 // (1) Sequential string? If yes, go to (4). 1309 // (1) Sequential string? If yes, go to (4).
1310 __ and_(r1, 1310 __ and_(r1,
1311 r0, 1311 r0,
1312 Operand(kIsNotStringMask | 1312 Operand(kIsNotStringMask |
1313 kStringRepresentationMask | 1313 kStringRepresentationMask |
1314 kShortExternalStringMask), 1314 kShortExternalStringMask),
1315 SetCC); 1315 SetCC);
1316 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0); 1316 STATIC_ASSERT((kStringTag | kSeqStringTag) == 0);
1317 __ b(eq, &seq_string); // Go to (4). 1317 __ b(eq, &seq_string); // Go to (4).
1318 1318
1319 // (2) Sequential or cons? If not, go to (5). 1319 // (2) Sequential or cons? If not, go to (5).
1320 STATIC_ASSERT(kConsStringTag < kExternalStringTag); 1320 STATIC_ASSERT(kConsStringTag < kExternalStringTag);
1321 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag); 1321 STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
1322 STATIC_ASSERT(kThinStringTag > kExternalStringTag);
1322 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag); 1323 STATIC_ASSERT(kIsNotStringMask > kExternalStringTag);
1323 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag); 1324 STATIC_ASSERT(kShortExternalStringTag > kExternalStringTag);
1324 __ cmp(r1, Operand(kExternalStringTag)); 1325 __ cmp(r1, Operand(kExternalStringTag));
1325 __ b(ge, &not_seq_nor_cons); // Go to (5). 1326 __ b(ge, &not_seq_nor_cons); // Go to (5).
1326 1327
1327 // (3) Cons string. Check that it's flat. 1328 // (3) Cons string. Check that it's flat.
1328 // Replace subject with first string and reload instance type. 1329 // Replace subject with first string and reload instance type.
1329 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset)); 1330 __ ldr(r0, FieldMemOperand(subject, ConsString::kSecondOffset));
1330 __ CompareRoot(r0, Heap::kempty_stringRootIndex); 1331 __ CompareRoot(r0, Heap::kempty_stringRootIndex);
1331 __ b(ne, &runtime); 1332 __ b(ne, &runtime);
1332 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset)); 1333 __ ldr(subject, FieldMemOperand(subject, ConsString::kFirstOffset));
1333 __ jmp(&check_underlying); 1334 __ jmp(&check_underlying);
1334 1335
1335 // (4) Sequential string. Load regexp code according to encoding. 1336 // (4) Sequential string. Load regexp code according to encoding.
1336 __ bind(&seq_string); 1337 __ bind(&seq_string);
1337 // subject: sequential subject string (or look-alike, external string) 1338 // subject: sequential subject string (or look-alike, external string)
1338 // r3: original subject string 1339 // r3: original subject string
1339 // Load previous index and check range before r3 is overwritten. We have to 1340 // Load previous index and check range before r3 is overwritten. We have to
1340 // use r3 instead of subject here because subject might have been only made 1341 // use r3 instead of subject here because subject might have been only made
1341 // to look like a sequential string when it actually is an external string. 1342 // to look like a sequential string when it actually is an external string.
1342 __ ldr(r1, MemOperand(sp, kPreviousIndexOffset)); 1343 __ ldr(r1, MemOperand(sp, kPreviousIndexOffset));
1343 __ JumpIfNotSmi(r1, &runtime); 1344 __ JumpIfNotSmi(r1, &runtime);
1344 __ ldr(r3, FieldMemOperand(r3, String::kLengthOffset)); 1345 __ ldr(r3, FieldMemOperand(r3, String::kLengthOffset));
1345 __ cmp(r3, Operand(r1)); 1346 __ cmp(r3, Operand(r1));
1346 __ b(ls, &runtime); 1347 __ b(ls, &runtime);
1347 __ SmiUntag(r1); 1348 __ SmiUntag(r1);
1348 1349
1349 STATIC_ASSERT(4 == kOneByteStringTag); 1350 STATIC_ASSERT(8 == kOneByteStringTag);
1350 STATIC_ASSERT(kTwoByteStringTag == 0); 1351 STATIC_ASSERT(kTwoByteStringTag == 0);
1351 __ and_(r0, r0, Operand(kStringEncodingMask)); 1352 __ and_(r0, r0, Operand(kStringEncodingMask));
1352 __ mov(r3, Operand(r0, ASR, 2), SetCC); 1353 __ mov(r3, Operand(r0, ASR, 3), SetCC);
1353 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset), 1354 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataOneByteCodeOffset),
1354 ne); 1355 ne);
1355 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq); 1356 __ ldr(r6, FieldMemOperand(regexp_data, JSRegExp::kDataUC16CodeOffset), eq);
1356 1357
1357 // (E) Carry on. String handling is done. 1358 // (E) Carry on. String handling is done.
1358 // r6: irregexp code 1359 // r6: irregexp code
1359 // Check that the irregexp code has been generated for the actual string 1360 // Check that the irregexp code has been generated for the actual string
1360 // encoding. If it has, the field contains a code object otherwise it contains 1361 // encoding. If it has, the field contains a code object otherwise it contains
1361 // a smi (code flushing support). 1362 // a smi (code flushing support).
1362 __ JumpIfSmi(r6, &runtime); 1363 __ JumpIfSmi(r6, &runtime);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 subject, 1577 subject,
1577 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag)); 1578 Operand(SeqTwoByteString::kHeaderSize - kHeapObjectTag));
1578 __ jmp(&seq_string); // Go to (4). 1579 __ jmp(&seq_string); // Go to (4).
1579 1580
1580 // (7) Short external string or not a string? If yes, bail out to runtime. 1581 // (7) Short external string or not a string? If yes, bail out to runtime.
1581 __ bind(&not_long_external); 1582 __ bind(&not_long_external);
1582 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0); 1583 STATIC_ASSERT(kNotStringTag != 0 && kShortExternalStringTag !=0);
1583 __ tst(r1, Operand(kIsNotStringMask | kShortExternalStringMask)); 1584 __ tst(r1, Operand(kIsNotStringMask | kShortExternalStringMask));
1584 __ b(ne, &runtime); 1585 __ b(ne, &runtime);
1585 1586
1586 // (8) Sliced string. Replace subject with parent. Go to (4). 1587 // (8) Sliced or thin string. Replace subject with parent. Go to (4).
1588 Label thin_string;
1589 __ cmp(r1, Operand(kThinStringTag));
1590 __ b(eq, &thin_string);
1587 // Load offset into r9 and replace subject string with parent. 1591 // Load offset into r9 and replace subject string with parent.
1588 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset)); 1592 __ ldr(r9, FieldMemOperand(subject, SlicedString::kOffsetOffset));
1589 __ SmiUntag(r9); 1593 __ SmiUntag(r9);
1590 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); 1594 __ ldr(subject, FieldMemOperand(subject, SlicedString::kParentOffset));
1591 __ jmp(&check_underlying); // Go to (4). 1595 __ jmp(&check_underlying); // Go to (4).
1596
1597 __ bind(&thin_string);
1598 __ ldr(subject, FieldMemOperand(subject, ThinString::kActualOffset));
1599 __ jmp(&check_underlying); // Go to (4).
1592 #endif // V8_INTERPRETED_REGEXP 1600 #endif // V8_INTERPRETED_REGEXP
1593 } 1601 }
1594 1602
1595 1603
1596 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1604 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1597 // r0 : number of arguments to the construct function 1605 // r0 : number of arguments to the construct function
1598 // r1 : the function to call 1606 // r1 : the function to call
1599 // r2 : feedback vector 1607 // r2 : feedback vector
1600 // r3 : slot in feedback vector (Smi) 1608 // r3 : slot in feedback vector (Smi)
1601 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1609 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4085 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4093 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4086 kStackUnwindSpace, NULL, return_value_operand, NULL); 4094 kStackUnwindSpace, NULL, return_value_operand, NULL);
4087 } 4095 }
4088 4096
4089 #undef __ 4097 #undef __
4090 4098
4091 } // namespace internal 4099 } // namespace internal
4092 } // namespace v8 4100 } // namespace v8
4093 4101
4094 #endif // V8_TARGET_ARCH_ARM 4102 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698