Commit 7ebde180 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[Torque] Eliminate unnecessarily unique namespaces for more builtins

Specifically string, object, proxy & regexp.
With this CL, the pattern is removed from all torque files.

R=tebbi@chromium.org

Change-Id: Ifcc1efda6053df8f02fc730825055f6cd5644e84
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1873691
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64527}
parent a1f14838
......@@ -28,7 +28,7 @@ namespace runtime {
namespace object {
transitioning macro
ObjectIsExtensible(implicit context: Context)(object: JSAny): JSAny {
ObjectIsExtensibleImpl(implicit context: Context)(object: JSAny): JSAny {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::ObjectIsExtensible(objectJSReceiver);
......@@ -57,7 +57,7 @@ namespace object {
}
transitioning macro
ObjectGetPrototypeOf(implicit context: Context)(object: JSAny): JSAny {
ObjectGetPrototypeOfImpl(implicit context: Context)(object: JSAny): JSAny {
const objectJSReceiver: JSReceiver = ToObject_Inline(context, object);
return object::JSReceiverGetPrototypeOf(objectJSReceiver);
}
......@@ -90,33 +90,25 @@ namespace object {
objectJSReceiver, proto);
return proxy::ProxySetPrototypeOf(objectJSProxy, proto, False);
}
} // namespace object
namespace object_isextensible {
// ES6 section 19.1.2.11 Object.isExtensible ( O )
transitioning javascript builtin
ObjectIsExtensible(js-implicit context: Context)(object: JSAny): JSAny {
return object::ObjectIsExtensible(object);
return object::ObjectIsExtensibleImpl(object);
}
} // namespace object_isextensible
namespace object_preventextensions {
// ES6 section 19.1.2.11 Object.isExtensible ( O )
// ES6 section 19.1.2.18 Object.preventExtensions ( O )
transitioning javascript builtin
ObjectPreventExtensions(js-implicit context: Context)(object: JSAny): JSAny {
return object::ObjectPreventExtensionsThrow(object);
}
} // namespace object_preventextensions
namespace object_getprototypeof {
// ES6 section 19.1.2.9 Object.getPrototypeOf ( O )
transitioning javascript builtin
ObjectGetPrototypeOf(js-implicit context: Context)(object: JSAny): JSAny {
return object::ObjectGetPrototypeOf(object);
return object::ObjectGetPrototypeOfImpl(object);
}
} // namespace object_getprototypeof
namespace object_setprototypeof {
// ES6 section 19.1.2.21 Object.setPrototypeOf ( O, proto )
transitioning javascript builtin ObjectSetPrototypeOf(
js-implicit context: Context)(object: JSAny, proto: JSAny): JSAny {
......@@ -138,4 +130,4 @@ namespace object_setprototypeof {
}
}
}
} // namespace object_setprototypeof
} // namespace object
......@@ -39,14 +39,14 @@ namespace proxy {
// 9. Let extensibleTarget be ? IsExtensible(target).
// 10. If extensibleTarget is true, return handlerProto.
const extensibleTarget: JSAny = object::ObjectIsExtensible(target);
const extensibleTarget: JSAny = object::ObjectIsExtensibleImpl(target);
assert(extensibleTarget == True || extensibleTarget == False);
if (extensibleTarget == True) {
return handlerProto;
}
// 11. Let targetProto be ? target.[[GetPrototypeOf]]().
const targetProto = object::ObjectGetPrototypeOf(target);
const targetProto = object::ObjectGetPrototypeOfImpl(target);
// 12. If SameValue(handlerProto, targetProto) is false, throw a TypeError
// exception.
......@@ -58,7 +58,7 @@ namespace proxy {
}
label TrapUndefined(target: JSAny) {
// 6.a. Return ? target.[[GetPrototypeOf]]().
return object::ObjectGetPrototypeOf(target);
return object::ObjectGetPrototypeOfImpl(target);
}
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(kProxyRevoked, kTrapName);
......
......@@ -33,7 +33,8 @@ namespace proxy {
const trapResult = ToBoolean(Call(context, trap, handler, target));
// 8. Let targetResult be ? IsExtensible(target).
const targetResult: bool = ToBoolean(object::ObjectIsExtensible(target));
const targetResult: bool =
ToBoolean(object::ObjectIsExtensibleImpl(target));
// 9. If SameValue(booleanTrapResult, targetResult) is false, throw a
// TypeError exception.
......@@ -47,7 +48,7 @@ namespace proxy {
}
label TrapUndefined(target: JSAny) {
// 6.a. Return ? IsExtensible(target).
return object::ObjectIsExtensible(target);
return object::ObjectIsExtensibleImpl(target);
}
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(kProxyRevoked, kTrapName);
......
......@@ -37,7 +37,7 @@ namespace proxy {
// 8.a. Let extensibleTarget be ? IsExtensible(target).
// 8.b If extensibleTarget is true, throw a TypeError exception.
if (ToBoolean(trapResult)) {
const extensibleTarget: JSAny = object::ObjectIsExtensible(target);
const extensibleTarget: JSAny = object::ObjectIsExtensibleImpl(target);
assert(extensibleTarget == True || extensibleTarget == False);
if (extensibleTarget == True) {
ThrowTypeError(kProxyPreventExtensionsExtensible);
......
......@@ -46,14 +46,14 @@ namespace proxy {
// 10. Let extensibleTarget be ? IsExtensible(target).
// 11. If extensibleTarget is true, return true.
const extensibleTarget: Object = object::ObjectIsExtensible(target);
const extensibleTarget: Object = object::ObjectIsExtensibleImpl(target);
assert(extensibleTarget == True || extensibleTarget == False);
if (extensibleTarget == True) {
return True;
}
// 12. Let targetProto be ? target.[[GetPrototypeOf]]().
const targetProto = object::ObjectGetPrototypeOf(target);
const targetProto = object::ObjectGetPrototypeOfImpl(target);
// 13. If SameValue(V, targetProto) is false, throw a TypeError
// exception.
......
......@@ -12,7 +12,7 @@ namespace reflect {
ReflectIsExtensible(js-implicit context: Context)(object: JSAny): JSAny {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.isExtensible');
return object::ObjectIsExtensible(objectJSReceiver);
return object::ObjectIsExtensibleImpl(objectJSReceiver);
}
// ES6 section 26.1.12 Reflect.preventExtensions
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_html {
namespace string {
extern runtime StringEscapeQuotes(Context, String): String;
// https://tc39.github.io/ecma262/#sec-createhtml
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_iterator {
namespace string {
macro NewJSStringIterator(implicit context: Context)(
string: String, nextIndex: Smi): JSStringIterator {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_repeat {
namespace string {
const kBuiltinName: constexpr string = 'String.prototype.repeat';
builtin StringRepeat(implicit context: Context)(string: String, count: Smi):
......
......@@ -2,11 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_slice {
extern macro StringBuiltinsAssembler::SubString(String, uintptr, uintptr):
String;
namespace string {
// ES6 #sec-string.prototype.slice ( start, end )
// https://tc39.github.io/ecma262/#sec-string.prototype.slice
transitioning javascript builtin StringPrototypeSlice(
......
......@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_substr {
extern macro StringBuiltinsAssembler::SubString(String, uintptr, uintptr):
String;
namespace string {
// String.prototype.substr ( start, length )
// ES6 #sec-string.prototype.substr
......
......@@ -2,10 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace string_substring {
extern macro StringBuiltinsAssembler::SubString(String, uintptr, uintptr):
String;
namespace string {
// ES6 #sec-string.prototype.substring
transitioning javascript builtin StringPrototypeSubstring(
......
......@@ -5,6 +5,9 @@
#include 'src/builtins/builtins-string-gen.h'
namespace string {
extern macro StringBuiltinsAssembler::SubString(String, uintptr, uintptr):
String;
// ES6 #sec-string.prototype.tostring
transitioning javascript builtin
StringPrototypeToString(js-implicit context: Context, receiver: JSAny)():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment