| 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 9046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9100 // explicitly via a with-statement. | 9101 // explicitly via a with-statement. |
| 9101 Object* constructor = holder->map()->constructor(); | 9102 Object* constructor = holder->map()->constructor(); |
| 9102 if (constructor != context_extension_function) return holder; | 9103 if (constructor != context_extension_function) return holder; |
| 9103 // Fall back to using the global object as the implicit receiver if | 9104 // Fall back to using the global object as the implicit receiver if |
| 9104 // the property turns out to be a local variable allocated in a | 9105 // the property turns out to be a local variable allocated in a |
| 9105 // context extension object - introduced via eval. | 9106 // context extension object - introduced via eval. |
| 9106 return isolate->heap()->undefined_value(); | 9107 return isolate->heap()->undefined_value(); |
| 9107 } | 9108 } |
| 9108 | 9109 |
| 9109 | 9110 |
| 9111 static ObjectPair LoadWithContextSlot(Isolate* isolate, Handle<String> name, |
| 9112 Handle<JSReceiver> object, |
| 9113 Handle<Object> receiver_handle) { |
| 9114 bool ok; |
| 9115 Handle<JSReceiver> holder; |
| 9116 PropertyAttributes attrs = |
| 9117 UnscopableLookup(isolate, object, name, &holder, &ok); |
| 9118 if (!ok) { |
| 9119 return MakePair(isolate->heap()->exception(), NULL); |
| 9120 } |
| 9121 if (attrs != ABSENT) { |
| 9122 LookupIterator it(object, name, holder, LookupIterator::CHECK_OWN); |
| 9123 Handle<Object> value; |
| 9124 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 9125 isolate, value, Object::GetPropertyForUnscopables(&it), |
| 9126 MakePair(isolate->heap()->exception(), NULL)); |
| 9127 |
| 9128 return MakePair(*value, *receiver_handle); |
| 9129 } |
| 9130 |
| 9131 return MakePair(isolate->heap()->undefined_value(), |
| 9132 isolate->heap()->undefined_value()); |
| 9133 } |
| 9134 |
| 9135 |
| 9110 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, | 9136 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, |
| 9111 bool throw_error) { | 9137 bool throw_error) { |
| 9112 HandleScope scope(isolate); | 9138 HandleScope scope(isolate); |
| 9113 ASSERT_EQ(2, args.length()); | 9139 ASSERT_EQ(2, args.length()); |
| 9114 | 9140 |
| 9115 if (!args[0]->IsContext() || !args[1]->IsString()) { | 9141 if (!args[0]->IsContext() || !args[1]->IsString()) { |
| 9116 return MakePair(isolate->ThrowIllegalOperation(), NULL); | 9142 return MakePair(isolate->ThrowIllegalOperation(), NULL); |
| 9117 } | 9143 } |
| 9118 Handle<Context> context = args.at<Context>(0); | 9144 Handle<Context> context = args.at<Context>(0); |
| 9119 Handle<String> name = args.at<String>(1); | 9145 Handle<String> name = args.at<String>(1); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9173 Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder); | 9199 Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder); |
| 9174 ASSERT(object->IsJSProxy() || JSReceiver::HasProperty(object, name)); | 9200 ASSERT(object->IsJSProxy() || JSReceiver::HasProperty(object, name)); |
| 9175 // GetProperty below can cause GC. | 9201 // GetProperty below can cause GC. |
| 9176 Handle<Object> receiver_handle( | 9202 Handle<Object> receiver_handle( |
| 9177 object->IsGlobalObject() | 9203 object->IsGlobalObject() |
| 9178 ? Object::cast(isolate->heap()->undefined_value()) | 9204 ? Object::cast(isolate->heap()->undefined_value()) |
| 9179 : object->IsJSProxy() ? static_cast<Object*>(*object) | 9205 : object->IsJSProxy() ? static_cast<Object*>(*object) |
| 9180 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), | 9206 : ComputeReceiverForNonGlobal(isolate, JSObject::cast(*object)), |
| 9181 isolate); | 9207 isolate); |
| 9182 | 9208 |
| 9209 if (FLAG_harmony_unscopables && context->IsWithContext()) { |
| 9210 return LoadWithContextSlot(isolate, name, object, receiver_handle); |
| 9211 } |
| 9212 |
| 9183 // No need to unhole the value here. This is taken care of by the | 9213 // No need to unhole the value here. This is taken care of by the |
| 9184 // GetProperty function. | 9214 // GetProperty function. |
| 9185 Handle<Object> value; | 9215 Handle<Object> value; |
| 9186 ASSIGN_RETURN_ON_EXCEPTION_VALUE( | 9216 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 9187 isolate, value, | 9217 isolate, value, |
| 9188 Object::GetProperty(object, name), | 9218 Object::GetProperty(object, name), |
| 9189 MakePair(isolate->heap()->exception(), NULL)); | 9219 MakePair(isolate->heap()->exception(), NULL)); |
| 9190 return MakePair(*value, *receiver_handle); | 9220 return MakePair(*value, *receiver_handle); |
| 9191 } | 9221 } |
| 9192 | 9222 |
| (...skipping 5777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14970 } | 15000 } |
| 14971 return NULL; | 15001 return NULL; |
| 14972 } | 15002 } |
| 14973 | 15003 |
| 14974 | 15004 |
| 14975 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15005 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 14976 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15006 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 14977 } | 15007 } |
| 14978 | 15008 |
| 14979 } } // namespace v8::internal | 15009 } } // namespace v8::internal |
| OLD | NEW |