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

Unified Diff: src/objects.cc

Issue 1745013002: [runtime] inline fast-path ToName (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d6c60f1845e7b32f6ac9456fd4f6567fdce72233..c1e00842d69038834ce085857e297e82aa6b10f7 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -115,16 +115,6 @@ MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
// static
-MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
- ASSIGN_RETURN_ON_EXCEPTION(
- isolate, input, Object::ToPrimitive(input, ToPrimitiveHint::kString),
- Name);
- if (input->IsName()) return Handle<Name>::cast(input);
- return ToString(isolate, input);
-}
-
-
-// static
MaybeHandle<Object> Object::ToNumber(Handle<Object> input) {
while (true) {
if (input->IsNumber()) {
@@ -175,6 +165,16 @@ MaybeHandle<Object> Object::ToUint32(Isolate* isolate, Handle<Object> input) {
// static
+MaybeHandle<Name> Object::ConvertToName(Isolate* isolate,
+ Handle<Object> input) {
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate, input, Object::ToPrimitive(input, ToPrimitiveHint::kString),
+ Name);
+ if (input->IsName()) return Handle<Name>::cast(input);
+ return ToString(isolate, input);
+}
+
+// static
MaybeHandle<String> Object::ToString(Isolate* isolate, Handle<Object> input) {
while (true) {
if (input->IsString()) {
@@ -892,26 +892,6 @@ bool Object::ToInt32(int32_t* value) {
}
-bool Object::ToUint32(uint32_t* value) {
- if (IsSmi()) {
- int num = Smi::cast(this)->value();
- if (num < 0) return false;
- *value = static_cast<uint32_t>(num);
- return true;
- }
- if (IsHeapNumber()) {
- double num = HeapNumber::cast(this)->value();
- if (num < 0) return false;
- uint32_t uint_value = FastD2UI(num);
- if (FastUI2D(uint_value) == num) {
- *value = uint_value;
- return true;
- }
- }
- return false;
-}
-
-
bool FunctionTemplateInfo::IsTemplateFor(Object* object) {
if (!object->IsHeapObject()) return false;
return IsTemplateFor(HeapObject::cast(object)->map());
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698