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

Side by Side Diff: src/api.cc

Issue 2090333002: Use instance type in Object::IsErrorObject(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@RefactorToString
Patch Set: Rebase + rename variable Created 4 years, 5 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 | « no previous file | 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 // 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 2990 matching lines...) Expand 10 before | Expand all | Expand 10 after
3001 value == i::FastUI2D(i::FastD2UI(value)); 3001 value == i::FastUI2D(i::FastD2UI(value));
3002 } 3002 }
3003 return false; 3003 return false;
3004 } 3004 }
3005 3005
3006 3006
3007 bool Value::IsNativeError() const { 3007 bool Value::IsNativeError() const {
3008 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3008 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3009 if (!obj->IsJSObject()) return false; 3009 if (!obj->IsJSObject()) return false;
3010 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj); 3010 i::Handle<i::JSObject> js_obj = i::Handle<i::JSObject>::cast(obj);
3011 i::Isolate* isolate = js_obj->GetIsolate(); 3011 return js_obj->map()->instance_type() == i::JS_ERROR_TYPE;
jochen (gone - plz use gerrit) 2016/06/23 14:42:15 why not just auto self = Utils::OpenHandle(this)
3012 i::Handle<i::Object> constructor(js_obj->map()->GetConstructor(), isolate);
3013 if (!constructor->IsJSFunction()) return false;
3014 i::Handle<i::JSFunction> function =
3015 i::Handle<i::JSFunction>::cast(constructor);
3016 if (!function->shared()->native()) return false;
3017 return function.is_identical_to(isolate->error_function()) ||
3018 function.is_identical_to(isolate->eval_error_function()) ||
3019 function.is_identical_to(isolate->range_error_function()) ||
3020 function.is_identical_to(isolate->reference_error_function()) ||
3021 function.is_identical_to(isolate->syntax_error_function()) ||
3022 function.is_identical_to(isolate->type_error_function()) ||
3023 function.is_identical_to(isolate->uri_error_function());
3024 } 3012 }
3025 3013
3026 3014
3027 bool Value::IsRegExp() const { 3015 bool Value::IsRegExp() const {
3028 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3016 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3029 return obj->IsJSRegExp(); 3017 return obj->IsJSRegExp();
3030 } 3018 }
3031 3019
3032 3020
3033 bool Value::IsGeneratorFunction() const { 3021 bool Value::IsGeneratorFunction() const {
(...skipping 5851 matching lines...) Expand 10 before | Expand all | Expand 10 after
8885 Address callback_address = 8873 Address callback_address =
8886 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8874 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8887 VMState<EXTERNAL> state(isolate); 8875 VMState<EXTERNAL> state(isolate);
8888 ExternalCallbackScope call_scope(isolate, callback_address); 8876 ExternalCallbackScope call_scope(isolate, callback_address);
8889 callback(info); 8877 callback(info);
8890 } 8878 }
8891 8879
8892 8880
8893 } // namespace internal 8881 } // namespace internal
8894 } // namespace v8 8882 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698