OLD | NEW |
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 2188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 bool Value::Equals(Handle<Value> that) const { | 2199 bool Value::Equals(Handle<Value> that) const { |
2200 if (IsDeadCheck("v8::Value::Equals()") | 2200 if (IsDeadCheck("v8::Value::Equals()") |
2201 || EmptyCheck("v8::Value::Equals()", this) | 2201 || EmptyCheck("v8::Value::Equals()", this) |
2202 || EmptyCheck("v8::Value::Equals()", that)) { | 2202 || EmptyCheck("v8::Value::Equals()", that)) { |
2203 return false; | 2203 return false; |
2204 } | 2204 } |
2205 LOG_API("Equals"); | 2205 LOG_API("Equals"); |
2206 ENTER_V8; | 2206 ENTER_V8; |
2207 i::Handle<i::Object> obj = Utils::OpenHandle(this); | 2207 i::Handle<i::Object> obj = Utils::OpenHandle(this); |
2208 i::Handle<i::Object> other = Utils::OpenHandle(*that); | 2208 i::Handle<i::Object> other = Utils::OpenHandle(*that); |
| 2209 // If both obj and other are JSObjects, we'd better compare by identity |
| 2210 // immediately when going into JS builtin. The reason is Invoke |
| 2211 // would overwrite global object receiver with global proxy. |
| 2212 if (obj->IsJSObject() && other->IsJSObject()) { |
| 2213 return *obj == *other; |
| 2214 } |
2209 i::Object** args[1] = { other.location() }; | 2215 i::Object** args[1] = { other.location() }; |
2210 EXCEPTION_PREAMBLE(); | 2216 EXCEPTION_PREAMBLE(); |
2211 i::Handle<i::Object> result = | 2217 i::Handle<i::Object> result = |
2212 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception); | 2218 CallV8HeapFunction("EQUALS", obj, 1, args, &has_pending_exception); |
2213 EXCEPTION_BAILOUT_CHECK(false); | 2219 EXCEPTION_BAILOUT_CHECK(false); |
2214 return *result == i::Smi::FromInt(i::EQUAL); | 2220 return *result == i::Smi::FromInt(i::EQUAL); |
2215 } | 2221 } |
2216 | 2222 |
2217 | 2223 |
2218 bool Value::StrictEquals(Handle<Value> that) const { | 2224 bool Value::StrictEquals(Handle<Value> that) const { |
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 | 5168 |
5163 | 5169 |
5164 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5170 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5165 HandleScopeImplementer* thread_local = | 5171 HandleScopeImplementer* thread_local = |
5166 reinterpret_cast<HandleScopeImplementer*>(storage); | 5172 reinterpret_cast<HandleScopeImplementer*>(storage); |
5167 thread_local->IterateThis(v); | 5173 thread_local->IterateThis(v); |
5168 return storage + ArchiveSpacePerThread(); | 5174 return storage + ArchiveSpacePerThread(); |
5169 } | 5175 } |
5170 | 5176 |
5171 } } // namespace v8::internal | 5177 } } // namespace v8::internal |
OLD | NEW |