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

Side by Side Diff: src/api.cc

Issue 225823003: Implement handlified String::Equals and Name::Equals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored StringToDouble Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/accessors.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | 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 // 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 2977 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 double x = obj->Number(); 2988 double x = obj->Number();
2989 double y = other->Number(); 2989 double y = other->Number();
2990 // Must check explicitly for NaN:s on Windows, but -0 works fine. 2990 // Must check explicitly for NaN:s on Windows, but -0 works fine.
2991 return x == y && !std::isnan(x) && !std::isnan(y); 2991 return x == y && !std::isnan(x) && !std::isnan(y);
2992 } else if (*obj == *other) { // Also covers Booleans. 2992 } else if (*obj == *other) { // Also covers Booleans.
2993 return true; 2993 return true;
2994 } else if (obj->IsSmi()) { 2994 } else if (obj->IsSmi()) {
2995 return other->IsNumber() && obj->Number() == other->Number(); 2995 return other->IsNumber() && obj->Number() == other->Number();
2996 } else if (obj->IsString()) { 2996 } else if (obj->IsString()) {
2997 return other->IsString() && 2997 return other->IsString() &&
2998 i::String::cast(*obj)->Equals(i::String::cast(*other)); 2998 i::String::Equals(i::Handle<i::String>::cast(obj),
2999 i::Handle<i::String>::cast(other));
2999 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) { 3000 } else if (obj->IsUndefined() || obj->IsUndetectableObject()) {
3000 return other->IsUndefined() || other->IsUndetectableObject(); 3001 return other->IsUndefined() || other->IsUndetectableObject();
3001 } else { 3002 } else {
3002 return false; 3003 return false;
3003 } 3004 }
3004 } 3005 }
3005 3006
3006 3007
3007 bool Value::SameValue(Handle<Value> that) const { 3008 bool Value::SameValue(Handle<Value> that) const {
3008 i::Isolate* isolate = i::Isolate::Current(); 3009 i::Isolate* isolate = i::Isolate::Current();
(...skipping 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after
7672 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7673 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7673 Address callback_address = 7674 Address callback_address =
7674 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7675 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7675 VMState<EXTERNAL> state(isolate); 7676 VMState<EXTERNAL> state(isolate);
7676 ExternalCallbackScope call_scope(isolate, callback_address); 7677 ExternalCallbackScope call_scope(isolate, callback_address);
7677 callback(info); 7678 callback(info);
7678 } 7679 }
7679 7680
7680 7681
7681 } } // namespace v8::internal 7682 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698