Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 #include "src/liveedit.h" | 34 #include "src/liveedit.h" |
| 35 #include "src/misc-intrinsics.h" | 35 #include "src/misc-intrinsics.h" |
| 36 #include "src/parser.h" | 36 #include "src/parser.h" |
| 37 #include "src/prototype.h" | 37 #include "src/prototype.h" |
| 38 #include "src/runtime.h" | 38 #include "src/runtime.h" |
| 39 #include "src/runtime-profiler.h" | 39 #include "src/runtime-profiler.h" |
| 40 #include "src/scopeinfo.h" | 40 #include "src/scopeinfo.h" |
| 41 #include "src/smart-pointers.h" | 41 #include "src/smart-pointers.h" |
| 42 #include "src/string-search.h" | 42 #include "src/string-search.h" |
| 43 #include "src/stub-cache.h" | 43 #include "src/stub-cache.h" |
| 44 #include "src/unscopables.h" | |
| 44 #include "src/uri.h" | 45 #include "src/uri.h" |
| 45 #include "src/v8threads.h" | 46 #include "src/v8threads.h" |
| 46 #include "src/vm-state-inl.h" | 47 #include "src/vm-state-inl.h" |
| 47 | 48 |
| 48 #ifdef V8_I18N_SUPPORT | 49 #ifdef V8_I18N_SUPPORT |
| 49 #include "src/i18n.h" | 50 #include "src/i18n.h" |
| 50 #include "unicode/brkiter.h" | 51 #include "unicode/brkiter.h" |
| 51 #include "unicode/calendar.h" | 52 #include "unicode/calendar.h" |
| 52 #include "unicode/coll.h" | 53 #include "unicode/coll.h" |
| 53 #include "unicode/curramt.h" | 54 #include "unicode/curramt.h" |
| (...skipping 9071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9125 // explicitly via a with-statement. | 9126 // explicitly via a with-statement. |
| 9126 Object* constructor = holder->map()->constructor(); | 9127 Object* constructor = holder->map()->constructor(); |
| 9127 if (constructor != context_extension_function) return holder; | 9128 if (constructor != context_extension_function) return holder; |
| 9128 // Fall back to using the global object as the implicit receiver if | 9129 // Fall back to using the global object as the implicit receiver if |
| 9129 // the property turns out to be a local variable allocated in a | 9130 // the property turns out to be a local variable allocated in a |
| 9130 // context extension object - introduced via eval. | 9131 // context extension object - introduced via eval. |
| 9131 return isolate->heap()->undefined_value(); | 9132 return isolate->heap()->undefined_value(); |
| 9132 } | 9133 } |
| 9133 | 9134 |
| 9134 | 9135 |
| 9136 static ObjectPair LoadWithContextSlot(Isolate* isolate, Handle<String> name, | |
| 9137 Handle<JSReceiver> object, | |
| 9138 Handle<Object> receiver_handle) { | |
| 9139 LookupIterator it(object, name); | |
| 9140 PropertyAttributes attrs = UnscopableLookup(&it); | |
|
Toon Verwaest
2014/07/25 10:09:41
An exception could already have been thrown in Uns
| |
| 9141 if (attrs != ABSENT) { | |
| 9142 Handle<Object> value; | |
| 9143 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | |
| 9144 isolate, value, Object::GetProperty(&it), | |
| 9145 MakePair(isolate->heap()->exception(), NULL)); | |
| 9146 | |
| 9147 return MakePair(*value, *receiver_handle); | |
| 9148 } | |
| 9149 | |
| 9150 return MakePair(isolate->heap()->undefined_value(), | |
| 9151 isolate->heap()->undefined_value()); | |
| 9152 } | |
| 9153 | |
| 9154 | |
| 9135 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, | 9155 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, |
| 9136 bool throw_error) { | 9156 bool throw_error) { |
| 9137 HandleScope scope(isolate); | 9157 HandleScope scope(isolate); |
| 9138 ASSERT_EQ(2, args.length()); | 9158 ASSERT_EQ(2, args.length()); |
| 9139 | 9159 |
| 9140 if (!args[0]->IsContext() || !args[1]->IsString()) { | 9160 if (!args[0]->IsContext() || !args[1]->IsString()) { |
| 9141 return MakePair(isolate->ThrowIllegalOperation(), NULL); | 9161 return MakePair(isolate->ThrowIllegalOperation(), NULL); |
| 9142 } | 9162 } |
| 9143 Handle<Context> context = args.at<Context>(0); | 9163 Handle<Context> context = args.at<Context>(0); |
| 9144 Handle<String> name = args.at<String>(1); | 9164 Handle<String> name = args.at<String>(1); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9198 Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder); | 9218 Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder); |
| 9199 ASSERT(object->IsJSProxy() || JSReceiver::HasProperty(object, name)); | 9219 ASSERT(object->IsJSProxy() || JSReceiver::HasProperty(object, name)); |
| 9200 // GetProperty below can cause GC. | 9220 // GetProperty below can cause GC. |
| 9201 Handle<Object> receiver_handle( | 9221 Handle<Object> receiver_handle( |
| 9202 object->IsGlobalObject() | 9222 object->IsGlobalObject() |
| 9203 ? Object::cast(isolate->heap()->undefined_value()) | 9223 ? Object::cast(isolate->heap()->undefined_value()) |
| 9204 : object->IsJSProxy() ? static_cast<Object*>(*object) | 9224 : object->IsJSProxy() ? static_cast<Object*>(*object) |
| 9205 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), | 9225 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), |
| 9206 isolate); | 9226 isolate); |
| 9207 | 9227 |
| 9228 if (FLAG_harmony_unscopables && context->IsWithContext()) { | |
| 9229 return LoadWithContextSlot(isolate, name, object, receiver_handle); | |
| 9230 } | |
| 9231 | |
| 9208 // No need to unhole the value here. This is taken care of by the | 9232 // No need to unhole the value here. This is taken care of by the |
| 9209 // GetProperty function. | 9233 // GetProperty function. |
| 9210 Handle<Object> value; | 9234 Handle<Object> value; |
| 9211 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 9235 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 9212 isolate, value, | 9236 isolate, value, |
| 9213 Object::GetProperty(object, name), | 9237 Object::GetProperty(object, name), |
| 9214 MakePair(isolate->heap()->exception(), NULL)); | 9238 MakePair(isolate->heap()->exception(), NULL)); |
| 9215 return MakePair(*value, *receiver_handle); | 9239 return MakePair(*value, *receiver_handle); |
| 9216 } | 9240 } |
| 9217 | 9241 |
| (...skipping 5777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14995 } | 15019 } |
| 14996 return NULL; | 15020 return NULL; |
| 14997 } | 15021 } |
| 14998 | 15022 |
| 14999 | 15023 |
| 15000 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15024 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15001 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15025 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15002 } | 15026 } |
| 15003 | 15027 |
| 15004 } } // namespace v8::internal | 15028 } } // namespace v8::internal |
| OLD | NEW |