 Chromium Code Reviews
 Chromium Code Reviews Issue 2090333002:
  Use instance type in Object::IsErrorObject().  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@RefactorToString
    
  
    Issue 2090333002:
  Use instance type in Object::IsErrorObject().  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@RefactorToString| OLD | NEW | 
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/objects.h" | 5 #include "src/objects.h" | 
| 6 | 6 | 
| 7 #include <cmath> | 7 #include <cmath> | 
| 8 #include <iomanip> | 8 #include <iomanip> | 
| 9 #include <sstream> | 9 #include <sstream> | 
| 10 | 10 | 
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 RETURN_ON_EXCEPTION_VALUE(isolate, Execution::Call(isolate, setter, receiver, | 1284 RETURN_ON_EXCEPTION_VALUE(isolate, Execution::Call(isolate, setter, receiver, | 
| 1285 arraysize(argv), argv), | 1285 arraysize(argv), argv), | 
| 1286 Nothing<bool>()); | 1286 Nothing<bool>()); | 
| 1287 return Just(true); | 1287 return Just(true); | 
| 1288 } | 1288 } | 
| 1289 | 1289 | 
| 1290 | 1290 | 
| 1291 // static | 1291 // static | 
| 1292 bool Object::IsErrorObject(Isolate* isolate, Handle<Object> object) { | 1292 bool Object::IsErrorObject(Isolate* isolate, Handle<Object> object) { | 
| 1293 if (!object->IsJSObject()) return false; | 1293 if (!object->IsJSObject()) return false; | 
| 1294 // Use stack_trace_symbol as proxy for [[ErrorData]]. | 1294 Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); | 
| 
Toon Verwaest
2016/06/23 12:04:39
since you know it's a JSObject, you might as well
 
Franzi
2016/06/23 14:10:19
Done.
 | |
| 1295 Handle<Name> symbol = isolate->factory()->stack_trace_symbol(); | 1295 return receiver->map()->instance_type() == JS_ERROR_TYPE; | 
| 1296 Maybe<bool> has_stack_trace = | |
| 1297 JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), symbol); | |
| 1298 DCHECK(!has_stack_trace.IsNothing()); | |
| 1299 return has_stack_trace.FromJust(); | |
| 1300 } | 1296 } | 
| 1301 | 1297 | 
| 1302 | 1298 | 
| 1303 // static | 1299 // static | 
| 1304 bool JSObject::AllCanRead(LookupIterator* it) { | 1300 bool JSObject::AllCanRead(LookupIterator* it) { | 
| 1305 // Skip current iteration, it's in state ACCESS_CHECK or INTERCEPTOR, both of | 1301 // Skip current iteration, it's in state ACCESS_CHECK or INTERCEPTOR, both of | 
| 1306 // which have already been checked. | 1302 // which have already been checked. | 
| 1307 DCHECK(it->state() == LookupIterator::ACCESS_CHECK || | 1303 DCHECK(it->state() == LookupIterator::ACCESS_CHECK || | 
| 1308 it->state() == LookupIterator::INTERCEPTOR); | 1304 it->state() == LookupIterator::INTERCEPTOR); | 
| 1309 for (it->Next(); it->IsFound(); it->Next()) { | 1305 for (it->Next(); it->IsFound(); it->Next()) { | 
| (...skipping 17543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18853 } else { | 18849 } else { | 
| 18854 // Old-style generators. | 18850 // Old-style generators. | 
| 18855 int offset = continuation(); | 18851 int offset = continuation(); | 
| 18856 CHECK(0 <= offset && offset < function()->code()->instruction_size()); | 18852 CHECK(0 <= offset && offset < function()->code()->instruction_size()); | 
| 18857 return function()->code()->SourcePosition(offset); | 18853 return function()->code()->SourcePosition(offset); | 
| 18858 } | 18854 } | 
| 18859 } | 18855 } | 
| 18860 | 18856 | 
| 18861 } // namespace internal | 18857 } // namespace internal | 
| 18862 } // namespace v8 | 18858 } // namespace v8 | 
| OLD | NEW |