OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 Handle<Object> result = v8::Utils::OpenHandle(*r); | 1092 Handle<Object> result = v8::Utils::OpenHandle(*r); |
1093 result->VerifyApiCallResultType(); | 1093 result->VerifyApiCallResultType(); |
1094 return *v8::Utils::OpenHandle(*r); | 1094 return *v8::Utils::OpenHandle(*r); |
1095 } | 1095 } |
1096 } | 1096 } |
1097 | 1097 |
1098 return isolate->heap()->no_interceptor_result_sentinel(); | 1098 return isolate->heap()->no_interceptor_result_sentinel(); |
1099 } | 1099 } |
1100 | 1100 |
1101 | 1101 |
1102 static MaybeObject* ThrowReferenceError(String* name) { | 1102 static MaybeObject* ThrowReferenceError(Isolate* isolate, String* name) { |
1103 // If the load is non-contextual, just return the undefined result. | 1103 // If the load is non-contextual, just return the undefined result. |
1104 // Note that both keyed and non-keyed loads may end up here, so we | 1104 // Note that both keyed and non-keyed loads may end up here, so we |
1105 // can't use either LoadIC or KeyedLoadIC constructors. | 1105 // can't use either LoadIC or KeyedLoadIC constructors. |
1106 IC ic(IC::NO_EXTRA_FRAME, Isolate::Current()); | 1106 IC ic(IC::NO_EXTRA_FRAME, isolate); |
1107 ASSERT(ic.target()->is_load_stub() || ic.target()->is_keyed_load_stub()); | 1107 ASSERT(ic.target()->is_load_stub() || ic.target()->is_keyed_load_stub()); |
1108 if (!ic.SlowIsUndeclaredGlobal()) return HEAP->undefined_value(); | 1108 if (!ic.SlowIsUndeclaredGlobal()) return HEAP->undefined_value(); |
1109 | 1109 |
1110 // Throw a reference error. | 1110 // Throw a reference error. |
1111 HandleScope scope; | 1111 HandleScope scope(isolate); |
1112 Handle<String> name_handle(name); | 1112 Handle<String> name_handle(name); |
1113 Handle<Object> error = | 1113 Handle<Object> error = |
1114 FACTORY->NewReferenceError("not_defined", | 1114 FACTORY->NewReferenceError("not_defined", |
1115 HandleVector(&name_handle, 1)); | 1115 HandleVector(&name_handle, 1)); |
1116 return Isolate::Current()->Throw(*error); | 1116 return isolate->Throw(*error); |
1117 } | 1117 } |
1118 | 1118 |
1119 | 1119 |
1120 static MaybeObject* LoadWithInterceptor(Arguments* args, | 1120 static MaybeObject* LoadWithInterceptor(Arguments* args, |
1121 PropertyAttributes* attrs) { | 1121 PropertyAttributes* attrs) { |
1122 Handle<String> name_handle = args->at<String>(0); | 1122 Handle<String> name_handle = args->at<String>(0); |
1123 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); | 1123 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); |
1124 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); | 1124 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); |
1125 Handle<JSObject> receiver_handle = args->at<JSObject>(2); | 1125 Handle<JSObject> receiver_handle = args->at<JSObject>(2); |
1126 Handle<JSObject> holder_handle = args->at<JSObject>(3); | 1126 Handle<JSObject> holder_handle = args->at<JSObject>(3); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 */ | 1168 */ |
1169 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) { | 1169 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForLoad) { |
1170 PropertyAttributes attr = NONE; | 1170 PropertyAttributes attr = NONE; |
1171 Object* result; | 1171 Object* result; |
1172 { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr); | 1172 { MaybeObject* maybe_result = LoadWithInterceptor(&args, &attr); |
1173 if (!maybe_result->ToObject(&result)) return maybe_result; | 1173 if (!maybe_result->ToObject(&result)) return maybe_result; |
1174 } | 1174 } |
1175 | 1175 |
1176 // If the property is present, return it. | 1176 // If the property is present, return it. |
1177 if (attr != ABSENT) return result; | 1177 if (attr != ABSENT) return result; |
1178 return ThrowReferenceError(String::cast(args[0])); | 1178 return ThrowReferenceError(isolate, String::cast(args[0])); |
1179 } | 1179 } |
1180 | 1180 |
1181 | 1181 |
1182 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { | 1182 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorForCall) { |
1183 PropertyAttributes attr; | 1183 PropertyAttributes attr; |
1184 MaybeObject* result = LoadWithInterceptor(&args, &attr); | 1184 MaybeObject* result = LoadWithInterceptor(&args, &attr); |
1185 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1185 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1186 // This is call IC. In this case, we simply return the undefined result which | 1186 // This is call IC. In this case, we simply return the undefined result which |
1187 // will lead to an exception when trying to invoke the result as a | 1187 // will lead to an exception when trying to invoke the result as a |
1188 // function. | 1188 // function. |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 Handle<FunctionTemplateInfo>( | 1764 Handle<FunctionTemplateInfo>( |
1765 FunctionTemplateInfo::cast(signature->receiver())); | 1765 FunctionTemplateInfo::cast(signature->receiver())); |
1766 } | 1766 } |
1767 } | 1767 } |
1768 | 1768 |
1769 is_simple_api_call_ = true; | 1769 is_simple_api_call_ = true; |
1770 } | 1770 } |
1771 | 1771 |
1772 | 1772 |
1773 } } // namespace v8::internal | 1773 } } // namespace v8::internal |
OLD | NEW |