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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 958053003: Removed funky Maybe constructor and made fields private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-object.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 return true; 906 return true;
907 } 907 }
908 908
909 // Function context extension. These are variables introduced by eval. 909 // Function context extension. These are variables introduced by eval.
910 if (function_context->closure() == *function) { 910 if (function_context->closure() == *function) {
911 if (function_context->has_extension() && 911 if (function_context->has_extension() &&
912 !function_context->IsNativeContext()) { 912 !function_context->IsNativeContext()) {
913 Handle<JSObject> ext(JSObject::cast(function_context->extension())); 913 Handle<JSObject> ext(JSObject::cast(function_context->extension()));
914 914
915 Maybe<bool> maybe = JSReceiver::HasProperty(ext, variable_name); 915 Maybe<bool> maybe = JSReceiver::HasProperty(ext, variable_name);
916 DCHECK(maybe.has_value); 916 DCHECK(maybe.IsJust());
917 if (maybe.value) { 917 if (maybe.FromJust()) {
918 // We don't expect this to do anything except replacing 918 // We don't expect this to do anything except replacing
919 // property value. 919 // property value.
920 Runtime::SetObjectProperty(isolate, ext, variable_name, new_value, 920 Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
921 SLOPPY).Assert(); 921 SLOPPY).Assert();
922 return true; 922 return true;
923 } 923 }
924 } 924 }
925 } 925 }
926 } 926 }
927 927
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 if (SetContextLocalValue(isolate, scope_info, context, variable_name, 989 if (SetContextLocalValue(isolate, scope_info, context, variable_name,
990 new_value)) { 990 new_value)) {
991 return true; 991 return true;
992 } 992 }
993 993
994 // Properties from the function context extension. This will 994 // Properties from the function context extension. This will
995 // be variables introduced by eval. 995 // be variables introduced by eval.
996 if (context->has_extension()) { 996 if (context->has_extension()) {
997 Handle<JSObject> ext(JSObject::cast(context->extension())); 997 Handle<JSObject> ext(JSObject::cast(context->extension()));
998 Maybe<bool> maybe = JSReceiver::HasProperty(ext, variable_name); 998 Maybe<bool> maybe = JSReceiver::HasProperty(ext, variable_name);
999 DCHECK(maybe.has_value); 999 DCHECK(maybe.IsJust());
1000 if (maybe.value) { 1000 if (maybe.FromJust()) {
1001 // We don't expect this to do anything except replacing property value. 1001 // We don't expect this to do anything except replacing property value.
1002 Runtime::DefineObjectProperty(ext, variable_name, new_value, NONE) 1002 Runtime::DefineObjectProperty(ext, variable_name, new_value, NONE)
1003 .Assert(); 1003 .Assert();
1004 return true; 1004 return true;
1005 } 1005 }
1006 } 1006 }
1007 1007
1008 return false; 1008 return false;
1009 } 1009 }
1010 1010
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 2106
2107 // Helper function to find or create the arguments object for 2107 // Helper function to find or create the arguments object for
2108 // Runtime_DebugEvaluate. 2108 // Runtime_DebugEvaluate.
2109 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeArgumentsObject( 2109 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeArgumentsObject(
2110 Isolate* isolate, Handle<JSObject> target, Handle<JSFunction> function) { 2110 Isolate* isolate, Handle<JSObject> target, Handle<JSFunction> function) {
2111 // Do not materialize the arguments object for eval or top-level code. 2111 // Do not materialize the arguments object for eval or top-level code.
2112 // Skip if "arguments" is already taken. 2112 // Skip if "arguments" is already taken.
2113 if (!function->shared()->is_function()) return target; 2113 if (!function->shared()->is_function()) return target;
2114 Maybe<bool> maybe = JSReceiver::HasOwnProperty( 2114 Maybe<bool> maybe = JSReceiver::HasOwnProperty(
2115 target, isolate->factory()->arguments_string()); 2115 target, isolate->factory()->arguments_string());
2116 if (!maybe.has_value) return MaybeHandle<JSObject>(); 2116 if (!maybe.IsJust()) return MaybeHandle<JSObject>();
2117 if (maybe.value) return target; 2117 if (maybe.FromJust()) return target;
2118 2118
2119 // FunctionGetArguments can't throw an exception. 2119 // FunctionGetArguments can't throw an exception.
2120 Handle<JSObject> arguments = 2120 Handle<JSObject> arguments =
2121 Handle<JSObject>::cast(Accessors::FunctionGetArguments(function)); 2121 Handle<JSObject>::cast(Accessors::FunctionGetArguments(function));
2122 Handle<String> arguments_str = isolate->factory()->arguments_string(); 2122 Handle<String> arguments_str = isolate->factory()->arguments_string();
2123 RETURN_ON_EXCEPTION(isolate, Runtime::DefineObjectProperty( 2123 RETURN_ON_EXCEPTION(isolate, Runtime::DefineObjectProperty(
2124 target, arguments_str, arguments, NONE), 2124 target, arguments_str, arguments, NONE),
2125 JSObject); 2125 JSObject);
2126 return target; 2126 return target;
2127 } 2127 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2811 return Smi::FromInt(isolate->debug()->is_active()); 2811 return Smi::FromInt(isolate->debug()->is_active());
2812 } 2812 }
2813 2813
2814 2814
2815 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { 2815 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) {
2816 UNIMPLEMENTED(); 2816 UNIMPLEMENTED();
2817 return NULL; 2817 return NULL;
2818 } 2818 }
2819 } 2819 }
2820 } // namespace v8::internal 2820 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698