Port StringPrototypeToString, StringPrototypeValueOf to Torque
Bug: v8:8996 Change-Id: I86104991d9732157c1fbdff273046bf4f7e0186f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1593853 Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com> Reviewed-by: Peter Wong <peter.wm.wong@gmail.com> Reviewed-by: Simon Zünd <szuend@chromium.org> Cr-Commit-Position: refs/heads/master@{#61221}
This commit is contained in:
parent
c862f5914d
commit
b061589ba3
1
BUILD.gn
1
BUILD.gn
@ -949,6 +949,7 @@ torque_files = [
|
||||
"src/builtins/proxy-revoke.tq",
|
||||
"src/builtins/regexp.tq",
|
||||
"src/builtins/regexp-replace.tq",
|
||||
"src/builtins/string.tq",
|
||||
"src/builtins/string-endswith.tq",
|
||||
"src/builtins/string-html.tq",
|
||||
"src/builtins/string-iterator.tq",
|
||||
|
@ -614,6 +614,7 @@ type WriteBarrierMode
|
||||
generates 'TNode<Int32T>' constexpr 'WriteBarrierMode';
|
||||
|
||||
type MessageTemplate constexpr 'MessageTemplate';
|
||||
type PrimitiveType constexpr 'PrimitiveType';
|
||||
type ToIntegerTruncationMode
|
||||
constexpr 'CodeStubAssembler::ToIntegerTruncationMode';
|
||||
type AllocationFlags constexpr 'AllocationFlags';
|
||||
@ -891,6 +892,9 @@ const kInvalidDataViewAccessorOffset: constexpr MessageTemplate
|
||||
const kStrictReadOnlyProperty: constexpr MessageTemplate
|
||||
generates 'MessageTemplate::kStrictReadOnlyProperty';
|
||||
|
||||
const kString: constexpr PrimitiveType
|
||||
generates 'PrimitiveType::kString';
|
||||
|
||||
type Hole extends Oddball;
|
||||
type Null extends Oddball;
|
||||
type Undefined extends Oddball;
|
||||
@ -1156,6 +1160,8 @@ extern transitioning macro ToSmiLength(implicit context: Context)(Object):
|
||||
extern transitioning macro ToString_Inline(Context, Object): String;
|
||||
extern transitioning macro ToThisString(implicit context: Context)(
|
||||
Object, String): String;
|
||||
extern transitioning macro ToThisValue(implicit context: Context)(
|
||||
Object, constexpr PrimitiveType, constexpr string): Object;
|
||||
extern transitioning macro GetProperty(implicit context: Context)(
|
||||
Object, Object): Object;
|
||||
extern transitioning builtin SetProperty(implicit context: Context)(
|
||||
|
@ -992,14 +992,10 @@ namespace internal {
|
||||
/* ES6 #sec-string.prototype.substring */ \
|
||||
TFJ(StringPrototypeSubstring, \
|
||||
SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
|
||||
/* ES6 #sec-string.prototype.tostring */ \
|
||||
TFJ(StringPrototypeToString, 0, kReceiver) \
|
||||
TFJ(StringPrototypeTrim, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
|
||||
TFJ(StringPrototypeTrimEnd, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
|
||||
TFJ(StringPrototypeTrimStart, \
|
||||
SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
|
||||
/* ES6 #sec-string.prototype.valueof */ \
|
||||
TFJ(StringPrototypeValueOf, 0, kReceiver) \
|
||||
/* ES6 #sec-string.raw */ \
|
||||
CPP(StringRaw) \
|
||||
\
|
||||
|
@ -2203,26 +2203,6 @@ void StringTrimAssembler::GotoIfNotWhiteSpaceOrLineTerminator(
|
||||
BIND(&out);
|
||||
}
|
||||
|
||||
// ES6 #sec-string.prototype.tostring
|
||||
TF_BUILTIN(StringPrototypeToString, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* receiver = Parameter(Descriptor::kReceiver);
|
||||
|
||||
Node* result = ToThisValue(context, receiver, PrimitiveType::kString,
|
||||
"String.prototype.toString");
|
||||
Return(result);
|
||||
}
|
||||
|
||||
// ES6 #sec-string.prototype.valueof
|
||||
TF_BUILTIN(StringPrototypeValueOf, CodeStubAssembler) {
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* receiver = Parameter(Descriptor::kReceiver);
|
||||
|
||||
Node* result = ToThisValue(context, receiver, PrimitiveType::kString,
|
||||
"String.prototype.valueOf");
|
||||
Return(result);
|
||||
}
|
||||
|
||||
// Return the |word32| codepoint at {index}. Supports SeqStrings and
|
||||
// ExternalStrings.
|
||||
TNode<Int32T> StringBuiltinsAssembler::LoadSurrogatePairAt(
|
||||
|
17
src/builtins/string.tq
Normal file
17
src/builtins/string.tq
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2019 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
namespace string {
|
||||
// ES6 #sec-string.prototype.tostring
|
||||
transitioning javascript builtin
|
||||
StringPrototypeToString(implicit context: Context)(receiver: Object): Object {
|
||||
return ToThisValue(receiver, kString, 'String.prototype.toString');
|
||||
}
|
||||
|
||||
// ES6 #sec-string.prototype.valueof
|
||||
transitioning javascript builtin
|
||||
StringPrototypeValueOf(implicit context: Context)(receiver: Object): Object {
|
||||
return ToThisValue(receiver, kString, 'String.prototype.valueOf');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user