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

Side by Side Diff: src/api.cc

Issue 24360017: Expose SameValue equality comparison algorithm (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 2 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 | « include/v8.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3037 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 return other->IsString() && 3048 return other->IsString() &&
3049 i::String::cast(*obj)->Equals(i::String::cast(*other)); 3049 i::String::cast(*obj)->Equals(i::String::cast(*other));
3050 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) { 3050 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
3051 return other->IsUndefined() || other->IsUndetectableObject(); 3051 return other->IsUndefined() || other->IsUndetectableObject();
3052 } else { 3052 } else {
3053 return false; 3053 return false;
3054 } 3054 }
3055 } 3055 }
3056 3056
3057 3057
3058 bool Value::SameValue(Handle<Value> that) const {
3059 i::Isolate* isolate = i::Isolate::Current();
3060 if (EmptyCheck("v8::Value::SameValue()", this) ||
3061 EmptyCheck("v8::Value::SameValue()", that)) {
3062 return false;
3063 }
3064 LOG_API(isolate, "SameValue");
3065 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3066 i::Handle<i::Object> other = Utils::OpenHandle(*that);
3067 return obj->SameValue(*other);
3068 }
3069
3070
3058 uint32_t Value::Uint32Value() const { 3071 uint32_t Value::Uint32Value() const {
3059 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3072 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3060 if (obj->IsSmi()) { 3073 if (obj->IsSmi()) {
3061 return i::Smi::cast(*obj)->value(); 3074 return i::Smi::cast(*obj)->value();
3062 } else { 3075 } else {
3063 i::Isolate* isolate = i::Isolate::Current(); 3076 i::Isolate* isolate = i::Isolate::Current();
3064 LOG_API(isolate, "Uint32Value"); 3077 LOG_API(isolate, "Uint32Value");
3065 ENTER_V8(isolate); 3078 ENTER_V8(isolate);
3066 EXCEPTION_PREAMBLE(isolate); 3079 EXCEPTION_PREAMBLE(isolate);
3067 i::Handle<i::Object> num = 3080 i::Handle<i::Object> num =
(...skipping 4461 matching lines...) Expand 10 before | Expand all | Expand 10 after
7529 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7542 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7530 Address callback_address = 7543 Address callback_address =
7531 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7544 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7532 VMState<EXTERNAL> state(isolate); 7545 VMState<EXTERNAL> state(isolate);
7533 ExternalCallbackScope call_scope(isolate, callback_address); 7546 ExternalCallbackScope call_scope(isolate, callback_address);
7534 callback(info); 7547 callback(info);
7535 } 7548 }
7536 7549
7537 7550
7538 } } // namespace v8::internal 7551 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698