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

Side by Side Diff: src/objects-inl.h

Issue 1745013002: [runtime] inline fast-path ToName (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « src/objects.cc ('k') | no next file » | 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 } else if (FLAG_track_double_fields && representation.IsDouble()) { 996 } else if (FLAG_track_double_fields && representation.IsDouble()) {
997 return IsMutableHeapNumber() || IsNumber(); 997 return IsMutableHeapNumber() || IsNumber();
998 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 998 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
999 return IsHeapObject(); 999 return IsHeapObject();
1000 } else if (FLAG_track_fields && representation.IsNone()) { 1000 } else if (FLAG_track_fields && representation.IsNone()) {
1001 return false; 1001 return false;
1002 } 1002 }
1003 return true; 1003 return true;
1004 } 1004 }
1005 1005
1006 bool Object::ToUint32(uint32_t* value) {
1007 if (IsSmi()) {
1008 int num = Smi::cast(this)->value();
1009 if (num < 0) return false;
1010 *value = static_cast<uint32_t>(num);
1011 return true;
1012 }
1013 if (IsHeapNumber()) {
1014 double num = HeapNumber::cast(this)->value();
1015 if (num < 0) return false;
1016 uint32_t uint_value = FastD2UI(num);
1017 if (FastUI2D(uint_value) == num) {
1018 *value = uint_value;
1019 return true;
1020 }
1021 }
1022 return false;
1023 }
1006 1024
1007 // static 1025 // static
1008 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate, 1026 MaybeHandle<JSReceiver> Object::ToObject(Isolate* isolate,
1009 Handle<Object> object) { 1027 Handle<Object> object) {
1010 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object); 1028 if (object->IsJSReceiver()) return Handle<JSReceiver>::cast(object);
1011 return ToObject(isolate, object, isolate->native_context()); 1029 return ToObject(isolate, object, isolate->native_context());
1012 } 1030 }
1013 1031
1014 1032
1015 // static 1033 // static
1034 MaybeHandle<Name> Object::ToName(Isolate* isolate, Handle<Object> input) {
1035 if (input->IsName()) return Handle<Name>::cast(input);
1036 return ConvertToName(isolate, input);
1037 }
1038
1039 // static
1016 MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input, 1040 MaybeHandle<Object> Object::ToPrimitive(Handle<Object> input,
1017 ToPrimitiveHint hint) { 1041 ToPrimitiveHint hint) {
1018 if (input->IsPrimitive()) return input; 1042 if (input->IsPrimitive()) return input;
1019 return JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(input), hint); 1043 return JSReceiver::ToPrimitive(Handle<JSReceiver>::cast(input), hint);
1020 } 1044 }
1021 1045
1022 1046
1023 bool Object::HasSpecificClassOf(String* name) { 1047 bool Object::HasSpecificClassOf(String* name) {
1024 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); 1048 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
1025 } 1049 }
(...skipping 6731 matching lines...) Expand 10 before | Expand all | Expand 10 after
7757 #undef WRITE_INT64_FIELD 7781 #undef WRITE_INT64_FIELD
7758 #undef READ_BYTE_FIELD 7782 #undef READ_BYTE_FIELD
7759 #undef WRITE_BYTE_FIELD 7783 #undef WRITE_BYTE_FIELD
7760 #undef NOBARRIER_READ_BYTE_FIELD 7784 #undef NOBARRIER_READ_BYTE_FIELD
7761 #undef NOBARRIER_WRITE_BYTE_FIELD 7785 #undef NOBARRIER_WRITE_BYTE_FIELD
7762 7786
7763 } // namespace internal 7787 } // namespace internal
7764 } // namespace v8 7788 } // namespace v8
7765 7789
7766 #endif // V8_OBJECTS_INL_H_ 7790 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698