OLD | NEW |
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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 Runtime::DefineObjectProperty(ext, variable_name, new_value, NONE) | 979 Runtime::DefineObjectProperty(ext, variable_name, new_value, NONE) |
980 .Assert(); | 980 .Assert(); |
981 return true; | 981 return true; |
982 } | 982 } |
983 } | 983 } |
984 | 984 |
985 return false; | 985 return false; |
986 } | 986 } |
987 | 987 |
988 | 988 |
| 989 static bool SetBlockContextVariableValue(Handle<Context> block_context, |
| 990 Handle<String> variable_name, |
| 991 Handle<Object> new_value) { |
| 992 DCHECK(block_context->IsBlockContext()); |
| 993 Handle<ScopeInfo> scope_info(ScopeInfo::cast(block_context->extension())); |
| 994 |
| 995 return SetContextLocalValue(block_context->GetIsolate(), scope_info, |
| 996 block_context, variable_name, new_value); |
| 997 } |
| 998 |
| 999 |
989 // Create a plain JSObject which materializes the scope for the specified | 1000 // Create a plain JSObject which materializes the scope for the specified |
990 // catch context. | 1001 // catch context. |
991 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope( | 1002 MUST_USE_RESULT static MaybeHandle<JSObject> MaterializeCatchScope( |
992 Isolate* isolate, Handle<Context> context) { | 1003 Isolate* isolate, Handle<Context> context) { |
993 DCHECK(context->IsCatchContext()); | 1004 DCHECK(context->IsCatchContext()); |
994 Handle<String> name(String::cast(context->extension())); | 1005 Handle<String> name(String::cast(context->extension())); |
995 Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX), | 1006 Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX), |
996 isolate); | 1007 isolate); |
997 Handle<JSObject> catch_scope = | 1008 Handle<JSObject> catch_scope = |
998 isolate->factory()->NewJSObject(isolate->object_function()); | 1009 isolate->factory()->NewJSObject(isolate->object_function()); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 variable_name, new_value); | 1308 variable_name, new_value); |
1298 case ScopeIterator::ScopeTypeWith: | 1309 case ScopeIterator::ScopeTypeWith: |
1299 break; | 1310 break; |
1300 case ScopeIterator::ScopeTypeCatch: | 1311 case ScopeIterator::ScopeTypeCatch: |
1301 return SetCatchVariableValue(isolate_, CurrentContext(), variable_name, | 1312 return SetCatchVariableValue(isolate_, CurrentContext(), variable_name, |
1302 new_value); | 1313 new_value); |
1303 case ScopeIterator::ScopeTypeClosure: | 1314 case ScopeIterator::ScopeTypeClosure: |
1304 return SetClosureVariableValue(isolate_, CurrentContext(), | 1315 return SetClosureVariableValue(isolate_, CurrentContext(), |
1305 variable_name, new_value); | 1316 variable_name, new_value); |
1306 case ScopeIterator::ScopeTypeBlock: | 1317 case ScopeIterator::ScopeTypeBlock: |
1307 // TODO(2399): should we implement it? | 1318 return SetBlockContextVariableValue(CurrentContext(), variable_name, |
1308 break; | 1319 new_value); |
1309 case ScopeIterator::ScopeTypeModule: | 1320 case ScopeIterator::ScopeTypeModule: |
1310 // TODO(2399): should we implement it? | 1321 // TODO(2399): should we implement it? |
1311 break; | 1322 break; |
1312 } | 1323 } |
1313 return false; | 1324 return false; |
1314 } | 1325 } |
1315 | 1326 |
1316 Handle<ScopeInfo> CurrentScopeInfo() { | 1327 Handle<ScopeInfo> CurrentScopeInfo() { |
1317 DCHECK(!failed_); | 1328 DCHECK(!failed_); |
1318 if (!nested_scope_chain_.is_empty()) { | 1329 if (!nested_scope_chain_.is_empty()) { |
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 return Smi::FromInt(isolate->debug()->is_active()); | 2733 return Smi::FromInt(isolate->debug()->is_active()); |
2723 } | 2734 } |
2724 | 2735 |
2725 | 2736 |
2726 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { | 2737 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { |
2727 UNIMPLEMENTED(); | 2738 UNIMPLEMENTED(); |
2728 return NULL; | 2739 return NULL; |
2729 } | 2740 } |
2730 } | 2741 } |
2731 } // namespace v8::internal | 2742 } // namespace v8::internal |
OLD | NEW |