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/debug/debug-evaluate.h" | 5 #include "src/debug/debug-evaluate.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/debug/debug-frames.h" | 10 #include "src/debug/debug-frames.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 element.scope_info); | 212 element.scope_info); |
213 } | 213 } |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void DebugEvaluate::ContextBuilder::MaterializeArgumentsObject( | 218 void DebugEvaluate::ContextBuilder::MaterializeArgumentsObject( |
219 Handle<JSObject> target, Handle<JSFunction> function) { | 219 Handle<JSObject> target, Handle<JSFunction> function) { |
220 // Do not materialize the arguments object for eval or top-level code. | 220 // Do not materialize the arguments object for eval or top-level code. |
221 // Skip if "arguments" is already taken. | 221 // Skip if "arguments" is already taken. |
222 if (!function->shared()->is_function()) return; | 222 if (function->shared()->is_toplevel()) return; |
223 Maybe<bool> maybe = JSReceiver::HasOwnProperty( | 223 Maybe<bool> maybe = JSReceiver::HasOwnProperty( |
224 target, isolate_->factory()->arguments_string()); | 224 target, isolate_->factory()->arguments_string()); |
225 DCHECK(maybe.IsJust()); | 225 DCHECK(maybe.IsJust()); |
226 if (maybe.FromJust()) return; | 226 if (maybe.FromJust()) return; |
227 | 227 |
228 // FunctionGetArguments can't throw an exception. | 228 // FunctionGetArguments can't throw an exception. |
229 Handle<JSObject> arguments = Accessors::FunctionGetArguments(function); | 229 Handle<JSObject> arguments = Accessors::FunctionGetArguments(function); |
230 Handle<String> arguments_str = isolate_->factory()->arguments_string(); | 230 Handle<String> arguments_str = isolate_->factory()->arguments_string(); |
231 JSObject::SetOwnPropertyIgnoreAttributes(target, arguments_str, arguments, | 231 JSObject::SetOwnPropertyIgnoreAttributes(target, arguments_str, arguments, |
232 NONE) | 232 NONE) |
(...skipping 11 matching lines...) Expand all Loading... |
244 return; | 244 return; |
245 } else if (local_function->shared()->scope_info()->HasReceiver() && | 245 } else if (local_function->shared()->scope_info()->HasReceiver() && |
246 !frame_->receiver()->IsTheHole(isolate_)) { | 246 !frame_->receiver()->IsTheHole(isolate_)) { |
247 recv = handle(frame_->receiver(), isolate_); | 247 recv = handle(frame_->receiver(), isolate_); |
248 } | 248 } |
249 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); | 249 JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); |
250 } | 250 } |
251 | 251 |
252 } // namespace internal | 252 } // namespace internal |
253 } // namespace v8 | 253 } // namespace v8 |
OLD | NEW |