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

Side by Side Diff: src/api.cc

Issue 1333843002: [runtime] Move binary operator fallbacks into the runtime. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: No need for frame states in bytecode handlers. Add test case. Created 5 years, 3 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
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 2902 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 Local<Boolean> Value::ToBoolean(Isolate* v8_isolate) const { 2913 Local<Boolean> Value::ToBoolean(Isolate* v8_isolate) const {
2914 return ToBoolean(v8_isolate->GetCurrentContext()).ToLocalChecked(); 2914 return ToBoolean(v8_isolate->GetCurrentContext()).ToLocalChecked();
2915 } 2915 }
2916 2916
2917 2917
2918 MaybeLocal<Number> Value::ToNumber(Local<Context> context) const { 2918 MaybeLocal<Number> Value::ToNumber(Local<Context> context) const {
2919 auto obj = Utils::OpenHandle(this); 2919 auto obj = Utils::OpenHandle(this);
2920 if (obj->IsNumber()) return ToApiHandle<Number>(obj); 2920 if (obj->IsNumber()) return ToApiHandle<Number>(obj);
2921 PREPARE_FOR_EXECUTION(context, "ToNumber", Number); 2921 PREPARE_FOR_EXECUTION(context, "ToNumber", Number);
2922 Local<Number> result; 2922 Local<Number> result;
2923 has_pending_exception = 2923 has_pending_exception = !ToLocal<Number>(i::Object::ToNumber(obj), &result);
2924 !ToLocal<Number>(i::Object::ToNumber(isolate, obj), &result);
2925 RETURN_ON_FAILED_EXECUTION(Number); 2924 RETURN_ON_FAILED_EXECUTION(Number);
2926 RETURN_ESCAPED(result); 2925 RETURN_ESCAPED(result);
2927 } 2926 }
2928 2927
2929 2928
2930 Local<Number> Value::ToNumber(Isolate* isolate) const { 2929 Local<Number> Value::ToNumber(Isolate* isolate) const {
2931 RETURN_TO_LOCAL_UNCHECKED(ToNumber(isolate->GetCurrentContext()), Number); 2930 RETURN_TO_LOCAL_UNCHECKED(ToNumber(isolate->GetCurrentContext()), Number);
2932 } 2931 }
2933 2932
2934 2933
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 bool Value::BooleanValue() const { 3237 bool Value::BooleanValue() const {
3239 return Utils::OpenHandle(this)->BooleanValue(); 3238 return Utils::OpenHandle(this)->BooleanValue();
3240 } 3239 }
3241 3240
3242 3241
3243 Maybe<double> Value::NumberValue(Local<Context> context) const { 3242 Maybe<double> Value::NumberValue(Local<Context> context) const {
3244 auto obj = Utils::OpenHandle(this); 3243 auto obj = Utils::OpenHandle(this);
3245 if (obj->IsNumber()) return Just(obj->Number()); 3244 if (obj->IsNumber()) return Just(obj->Number());
3246 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "NumberValue", double); 3245 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "NumberValue", double);
3247 i::Handle<i::Object> num; 3246 i::Handle<i::Object> num;
3248 has_pending_exception = !i::Object::ToNumber(isolate, obj).ToHandle(&num); 3247 has_pending_exception = !i::Object::ToNumber(obj).ToHandle(&num);
3249 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(double); 3248 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(double);
3250 return Just(num->Number()); 3249 return Just(num->Number());
3251 } 3250 }
3252 3251
3253 3252
3254 double Value::NumberValue() const { 3253 double Value::NumberValue() const {
3255 auto obj = Utils::OpenHandle(this); 3254 auto obj = Utils::OpenHandle(this);
3256 if (obj->IsNumber()) return obj->Number(); 3255 if (obj->IsNumber()) return obj->Number();
3257 return NumberValue(ContextFromHeapObject(obj)) 3256 return NumberValue(ContextFromHeapObject(obj))
3258 .FromMaybe(std::numeric_limits<double>::quiet_NaN()); 3257 .FromMaybe(std::numeric_limits<double>::quiet_NaN());
(...skipping 5144 matching lines...) Expand 10 before | Expand all | Expand 10 after
8403 Address callback_address = 8402 Address callback_address =
8404 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8403 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8405 VMState<EXTERNAL> state(isolate); 8404 VMState<EXTERNAL> state(isolate);
8406 ExternalCallbackScope call_scope(isolate, callback_address); 8405 ExternalCallbackScope call_scope(isolate, callback_address);
8407 callback(info); 8406 callback(info);
8408 } 8407 }
8409 8408
8410 8409
8411 } // namespace internal 8410 } // namespace internal
8412 } // namespace v8 8411 } // namespace v8
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/compiler/interpreter-assembler.h » ('j') | src/compiler/linkage.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698