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

Side by Side Diff: src/api.cc

Issue 6287018: Compare JSObjects by identity immediately. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing Mads' concerns Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-api.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 bool Value::Equals(Handle<Value> that) const { 2193 bool Value::Equals(Handle<Value> that) const {
2194 if (IsDeadCheck("v8::Value::Equals()") 2194 if (IsDeadCheck("v8::Value::Equals()")
2195 || EmptyCheck("v8::Value::Equals()", this) 2195 || EmptyCheck("v8::Value::Equals()", this)
2196 || EmptyCheck("v8::Value::Equals()", that)) { 2196 || EmptyCheck("v8::Value::Equals()", that)) {
2197 return false; 2197 return false;
2198 } 2198 }
2199 LOG_API("Equals"); 2199 LOG_API("Equals");
2200 ENTER_V8; 2200 ENTER_V8;
2201 i::Handle<i::Object> obj = Utils::OpenHandle(this); 2201 i::Handle<i::Object> obj = Utils::OpenHandle(this);
2202 i::Handle<i::Object> other = Utils::OpenHandle(*that); 2202 i::Handle<i::Object> other = Utils::OpenHandle(*that);
2203 // If both obj and other are JSObjects, we'd better compare by identity
2204 // immediately when going into JS builtin. The reason is Invoke
2205 // would overwrite global object receiver with global proxy.
2206 if (obj->IsJSObject() && other->IsJSObject()) {
2207 return *obj == *other;
2208 }
2203 i::Object** args[1] = { other.location() }; 2209 i::Object** args[1] = { other.location() };
2204 EXCEPTION_PREAMBLE(); 2210 EXCEPTION_PREAMBLE();
2205 i::Handle<i::Object> result = 2211 i::Handle<i::Object> result =
2206 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception); 2212 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception);
2207 EXCEPTION_BAILOUT_CHECK(false); 2213 EXCEPTION_BAILOUT_CHECK(false);
2208 return *result == i::Smi::FromInt(i::EQUAL); 2214 return *result == i::Smi::FromInt(i::EQUAL);
2209 } 2215 }
2210 2216
2211 2217
2212 bool Value::StrictEquals(Handle<Value> that) const { 2218 bool Value::StrictEquals(Handle<Value> that) const {
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after
5156 5162
5157 5163
5158 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5164 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5159 HandleScopeImplementer* thread_local = 5165 HandleScopeImplementer* thread_local =
5160 reinterpret_cast<HandleScopeImplementer*>(storage); 5166 reinterpret_cast<HandleScopeImplementer*>(storage);
5161 thread_local->IterateThis(v); 5167 thread_local->IterateThis(v);
5162 return storage + ArchiveSpacePerThread(); 5168 return storage + ArchiveSpacePerThread();
5163 } 5169 }
5164 5170
5165 } } // namespace v8::internal 5171 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698