Register index = r1;
Register value = r2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
Register index = r1;
Register value = r2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
Register value = x2;
Register scratch = x10;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(value, index);
if (FLAG_debug_code) {
Register value = x2;
Register scratch = x10;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(value, index);
if (FLAG_debug_code) {
void HOptimizedGraphBuilder::GenerateOneByteSeqStringSetChar(
CallRuntime* call) {
DCHECK(call->arguments()->length() == 3);
- // We need to follow the evaluation order of full codegen.
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
CHECK_ALIVE(VisitForValue(call->arguments()->at(2)));
- CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* string = Pop();
HValue* value = Pop();
HValue* index = Pop();
void HOptimizedGraphBuilder::GenerateTwoByteSeqStringSetChar(
CallRuntime* call) {
DCHECK(call->arguments()->length() == 3);
- // We need to follow the evaluation order of full codegen.
+ CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
CHECK_ALIVE(VisitForValue(call->arguments()->at(2)));
- CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* string = Pop();
HValue* value = Pop();
HValue* index = Pop();
Register index = ebx;
Register value = ecx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ pop(value);
__ pop(index);
Register index = ebx;
Register value = ecx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ pop(value);
__ pop(index);
Register index = a1;
Register value = a2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
Register index = a1;
Register value = a2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
Register index = a1;
Register value = a2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
Register index = a1;
Register value = a2;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(index, value);
if (FLAG_debug_code) {
RUNTIME_FUNCTION(RuntimeReference_OneByteSeqStringSetChar) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_CHECKED(SeqOneByteString, string, 0);
- CONVERT_INT32_ARG_CHECKED(index, 1);
- CONVERT_INT32_ARG_CHECKED(value, 2);
+ CONVERT_INT32_ARG_CHECKED(index, 0);
+ CONVERT_INT32_ARG_CHECKED(value, 1);
+ CONVERT_ARG_CHECKED(SeqOneByteString, string, 2);
string->SeqOneByteStringSet(index, value);
return string;
}
RUNTIME_FUNCTION(RuntimeReference_TwoByteSeqStringSetChar) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 3);
- CONVERT_ARG_CHECKED(SeqTwoByteString, string, 0);
- CONVERT_INT32_ARG_CHECKED(index, 1);
- CONVERT_INT32_ARG_CHECKED(value, 2);
+ CONVERT_INT32_ARG_CHECKED(index, 0);
+ CONVERT_INT32_ARG_CHECKED(value, 1);
+ CONVERT_ARG_CHECKED(SeqTwoByteString, string, 2);
string->SeqTwoByteStringSet(index, value);
return string;
}
if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
if (code < 0) code = code & 0xffff;
if (code > 0xff) break;
- %_OneByteSeqStringSetChar(one_byte, i, code);
+ %_OneByteSeqStringSetChar(i, code, one_byte);
}
if (i == n) return one_byte;
one_byte = %TruncateString(one_byte, i);
for (var j = 0; i < n; i++, j++) {
var code = %_Arguments(i);
if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
- %_TwoByteSeqStringSetChar(two_byte, j, code);
+ %_TwoByteSeqStringSetChar(j, code, two_byte);
}
return one_byte + two_byte;
}
throw new $URIError("URI malformed");
}
if (value < 0x10000) {
- %_TwoByteSeqStringSetChar(result, index++, value);
+ %_TwoByteSeqStringSetChar(index++, value, result);
} else {
- %_TwoByteSeqStringSetChar(result, index++, (value >> 10) + 0xd7c0);
- %_TwoByteSeqStringSetChar(result, index++, (value & 0x3ff) + 0xdc00);
+ %_TwoByteSeqStringSetChar(index++, (value >> 10) + 0xd7c0, result);
+ %_TwoByteSeqStringSetChar(index++, (value & 0x3ff) + 0xdc00, result);
}
return index;
}
var result = %NewString(array.length, NEW_ONE_BYTE_STRING);
for (var i = 0; i < array.length; i++) {
- %_OneByteSeqStringSetChar(result, i, array[i]);
+ %_OneByteSeqStringSetChar(i, array[i], result);
}
return result;
}
var cc = URIHexCharsToCharCode(uri.charCodeAt(k+1), uri.charCodeAt(k+2));
if (cc >> 7) break; // Assumption wrong, two-byte string.
if (reserved(cc)) {
- %_OneByteSeqStringSetChar(one_byte, index++, 37); // '%'.
- %_OneByteSeqStringSetChar(one_byte, index++, uri.charCodeAt(k+1));
- %_OneByteSeqStringSetChar(one_byte, index++, uri.charCodeAt(k+2));
+ %_OneByteSeqStringSetChar(index++, 37, one_byte); // '%'.
+ %_OneByteSeqStringSetChar(index++, uri.charCodeAt(k+1), one_byte);
+ %_OneByteSeqStringSetChar(index++, uri.charCodeAt(k+2), one_byte);
} else {
- %_OneByteSeqStringSetChar(one_byte, index++, cc);
+ %_OneByteSeqStringSetChar(index++, cc, one_byte);
}
k += 2;
} else {
if (code > 0x7f) break; // Assumption wrong, two-byte string.
- %_OneByteSeqStringSetChar(one_byte, index++, code);
+ %_OneByteSeqStringSetChar(index++, code, one_byte);
}
}
}
index = URIDecodeOctets(octets, two_byte, index);
} else if (reserved(cc)) {
- %_TwoByteSeqStringSetChar(two_byte, index++, 37); // '%'.
- %_TwoByteSeqStringSetChar(two_byte, index++, uri.charCodeAt(k - 1));
- %_TwoByteSeqStringSetChar(two_byte, index++, uri.charCodeAt(k));
+ %_TwoByteSeqStringSetChar(index++, 37, two_byte); // '%'.
+ %_TwoByteSeqStringSetChar(index++, uri.charCodeAt(k - 1), two_byte);
+ %_TwoByteSeqStringSetChar(index++, uri.charCodeAt(k), two_byte);
} else {
- %_TwoByteSeqStringSetChar(two_byte, index++, cc);
+ %_TwoByteSeqStringSetChar(index++, cc, two_byte);
}
} else {
- %_TwoByteSeqStringSetChar(two_byte, index++, code);
+ %_TwoByteSeqStringSetChar(index++, code, two_byte);
}
}
Register index = rbx;
Register value = rcx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(value);
__ Pop(index);
Register index = rbx;
Register value = rcx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ Pop(value);
__ Pop(index);
Register index = ebx;
Register value = ecx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ pop(value);
__ pop(index);
Register index = ebx;
Register value = ecx;
- VisitForStackValue(args->at(1)); // index
- VisitForStackValue(args->at(2)); // value
- VisitForAccumulatorValue(args->at(0)); // string
+ VisitForStackValue(args->at(0)); // index
+ VisitForStackValue(args->at(1)); // value
+ VisitForAccumulatorValue(args->at(2)); // string
__ pop(value);
__ pop(index);
function MyStringFromCharCode(code, i) {
var one_byte = %NewString(3, true);
- %_OneByteSeqStringSetChar(one_byte, 0, code);
- %_OneByteSeqStringSetChar(one_byte, 1, code);
- %_OneByteSeqStringSetChar(one_byte, i, code);
+ %_OneByteSeqStringSetChar(0, code, one_byte);
+ %_OneByteSeqStringSetChar(1, code, one_byte);
+ %_OneByteSeqStringSetChar(i, code, one_byte);
var two_byte = %NewString(3, false);
- %_TwoByteSeqStringSetChar(two_byte, 0, code);
- %_TwoByteSeqStringSetChar(two_byte, 1, code);
- %_TwoByteSeqStringSetChar(two_byte, i, code);
+ %_TwoByteSeqStringSetChar(0, code, two_byte);
+ %_TwoByteSeqStringSetChar(1, code, two_byte);
+ %_TwoByteSeqStringSetChar(i, code, two_byte);
return one_byte + two_byte;
}
var string = "hello world";
var expected = "Hello " + "world";
function Capitalize() {
- %_OneByteSeqStringSetChar(string, 0, 0x48);
+ %_OneByteSeqStringSetChar(0, 0x48, string);
}
Capitalize();
assertEquals(expected, string);
var twobyte = "\u20ACello world";
function TwoByteCapitalize() {
- %_TwoByteSeqStringSetChar(twobyte, 0, 0x48);
+ %_TwoByteSeqStringSetChar(0, 0x48, twobyte);
}
TwoByteCapitalize();
assertEquals(expected, twobyte);
var two_byte = %NewString(n - i, false);
for (var j = 0; i < n; i++, j++) {
var code = %_Arguments(i);
- %_TwoByteSeqStringSetChar(two_byte, j, code);
+ %_TwoByteSeqStringSetChar(j, code, two_byte);
}
return one_byte + two_byte;
}
function test() {
var string = %NewString(10, true);
for (var i = 0; i < 10; i++) {
- %_OneByteSeqStringSetChar(string, i, 65);
- %_OneByteSeqStringSetChar(string, i, 66);
+ %_OneByteSeqStringSetChar(i, 65, string);
+ %_OneByteSeqStringSetChar(i, 66, string);
}
for (var i = 0; i < 10; i++) {
assertEquals("B", string[i]);
function f(string, osr) {
var world = " world";
- %_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48));
+ %_OneByteSeqStringSetChar(0, (deopt(), 0x48), string);
if (osr) while (%GetOptimizationStatus(f) == 2) {}
}
function f(string) {
- g(%_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
+ g(%_OneByteSeqStringSetChar(0, (deopt(), 0x48), string));
return string;
}
}
function f(string) {
- g(%_TwoByteSeqStringSetChar(string, 0, (deopt(), 0x48)));
+ g(%_TwoByteSeqStringSetChar(0, (deopt(), 0x48), string));
return string;
}
function test() {
var s1 = %NewString(26, true);
- for (i = 0; i < 26; i++) %_OneByteSeqStringSetChar(s1, i, 65);
+ for (i = 0; i < 26; i++) %_OneByteSeqStringSetChar(i, 65, s1);
assertEquals("AAAAAAAAAAAAAAAAAAAAAAAAAA", s1);
- %_OneByteSeqStringSetChar(s1, 25, 66);
+ %_OneByteSeqStringSetChar(25, 66, s1);
assertEquals("AAAAAAAAAAAAAAAAAAAAAAAAAB", s1);
- for (i = 0; i < 26; i++) %_OneByteSeqStringSetChar(s1, i, i+65);
+ for (i = 0; i < 26; i++) %_OneByteSeqStringSetChar(i, i+65, s1);
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s1);
s1 = %TruncateString(s1, 13);
assertEquals("ABCDEFGHIJKLM", s1);
var s2 = %NewString(26, false);
- for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(s2, i, 65);
+ for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(i, 65, s2);
assertEquals("AAAAAAAAAAAAAAAAAAAAAAAAAA", s2);
- %_TwoByteSeqStringSetChar(s2, 25, 66);
+ %_TwoByteSeqStringSetChar(25, 66, s2);
assertEquals("AAAAAAAAAAAAAAAAAAAAAAAAAB", s2);
- for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(s2, i, i+65);
+ for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(i, i+65, s2);
assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s2);
s2 = %TruncateString(s2, 13);
assertEquals("ABCDEFGHIJKLM", s2);
var s3 = %NewString(26, false);
- for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(s3, i, i+1000);
+ for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(i, i+1000, s3);
for (i = 0; i < 26; i++) assertEquals(s3[i], String.fromCharCode(i+1000));
var a = [];