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 8960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8971 } | 8971 } |
8972 | 8972 |
8973 JSObject::PreventExtensions(module).Assert(); | 8973 JSObject::PreventExtensions(module).Assert(); |
8974 } | 8974 } |
8975 | 8975 |
8976 ASSERT(!isolate->has_pending_exception()); | 8976 ASSERT(!isolate->has_pending_exception()); |
8977 return isolate->heap()->undefined_value(); | 8977 return isolate->heap()->undefined_value(); |
8978 } | 8978 } |
8979 | 8979 |
8980 | 8980 |
8981 RUNTIME_FUNCTION(Runtime_DeleteContextSlot) { | 8981 RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) { |
8982 HandleScope scope(isolate); | 8982 HandleScope scope(isolate); |
8983 ASSERT(args.length() == 2); | 8983 ASSERT(args.length() == 2); |
8984 | 8984 |
8985 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); | 8985 CONVERT_ARG_HANDLE_CHECKED(Context, context, 0); |
8986 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); | 8986 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
8987 | 8987 |
8988 int index; | 8988 int index; |
8989 PropertyAttributes attributes; | 8989 PropertyAttributes attributes; |
8990 ContextLookupFlags flags = FOLLOW_CHAINS; | 8990 ContextLookupFlags flags = FOLLOW_CHAINS; |
8991 BindingFlags binding_flags; | 8991 BindingFlags binding_flags; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9084 // explicitly via a with-statement. | 9084 // explicitly via a with-statement. |
9085 Object* constructor = holder->map()->constructor(); | 9085 Object* constructor = holder->map()->constructor(); |
9086 if (constructor != context_extension_function) return holder; | 9086 if (constructor != context_extension_function) return holder; |
9087 // Fall back to using the global object as the implicit receiver if | 9087 // Fall back to using the global object as the implicit receiver if |
9088 // the property turns out to be a local variable allocated in a | 9088 // the property turns out to be a local variable allocated in a |
9089 // context extension object - introduced via eval. | 9089 // context extension object - introduced via eval. |
9090 return isolate->heap()->undefined_value(); | 9090 return isolate->heap()->undefined_value(); |
9091 } | 9091 } |
9092 | 9092 |
9093 | 9093 |
9094 static ObjectPair LoadContextSlotHelper(Arguments args, | 9094 static ObjectPair LoadLookupSlotHelper(Arguments args, Isolate* isolate, |
9095 Isolate* isolate, | 9095 bool throw_error) { |
9096 bool throw_error) { | |
9097 HandleScope scope(isolate); | 9096 HandleScope scope(isolate); |
9098 ASSERT_EQ(2, args.length()); | 9097 ASSERT_EQ(2, args.length()); |
9099 | 9098 |
9100 if (!args[0]->IsContext() || !args[1]->IsString()) { | 9099 if (!args[0]->IsContext() || !args[1]->IsString()) { |
9101 return MakePair(isolate->ThrowIllegalOperation(), NULL); | 9100 return MakePair(isolate->ThrowIllegalOperation(), NULL); |
9102 } | 9101 } |
9103 Handle<Context> context = args.at<Context>(0); | 9102 Handle<Context> context = args.at<Context>(0); |
9104 Handle<String> name = args.at<String>(1); | 9103 Handle<String> name = args.at<String>(1); |
9105 | 9104 |
9106 int index; | 9105 int index; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9182 HandleVector(&name, 1)); | 9181 HandleVector(&name, 1)); |
9183 return MakePair(isolate->Throw(*reference_error), NULL); | 9182 return MakePair(isolate->Throw(*reference_error), NULL); |
9184 } else { | 9183 } else { |
9185 // The property doesn't exist - return undefined. | 9184 // The property doesn't exist - return undefined. |
9186 return MakePair(isolate->heap()->undefined_value(), | 9185 return MakePair(isolate->heap()->undefined_value(), |
9187 isolate->heap()->undefined_value()); | 9186 isolate->heap()->undefined_value()); |
9188 } | 9187 } |
9189 } | 9188 } |
9190 | 9189 |
9191 | 9190 |
9192 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadContextSlot) { | 9191 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlot) { |
9193 return LoadContextSlotHelper(args, isolate, true); | 9192 return LoadLookupSlotHelper(args, isolate, true); |
9194 } | 9193 } |
9195 | 9194 |
9196 | 9195 |
9197 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadContextSlotNoReferenceError) { | 9196 RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotNoReferenceError) { |
9198 return LoadContextSlotHelper(args, isolate, false); | 9197 return LoadLookupSlotHelper(args, isolate, false); |
9199 } | 9198 } |
9200 | 9199 |
9201 | 9200 |
9202 RUNTIME_FUNCTION(Runtime_StoreLookupSlot) { | 9201 RUNTIME_FUNCTION(Runtime_StoreLookupSlot) { |
9203 HandleScope scope(isolate); | 9202 HandleScope scope(isolate); |
9204 ASSERT(args.length() == 4); | 9203 ASSERT(args.length() == 4); |
9205 | 9204 |
9206 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); | 9205 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); |
9207 CONVERT_ARG_HANDLE_CHECKED(Context, context, 1); | 9206 CONVERT_ARG_HANDLE_CHECKED(Context, context, 1); |
9208 CONVERT_ARG_HANDLE_CHECKED(String, name, 2); | 9207 CONVERT_ARG_HANDLE_CHECKED(String, name, 2); |
(...skipping 5747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14956 } | 14955 } |
14957 return NULL; | 14956 return NULL; |
14958 } | 14957 } |
14959 | 14958 |
14960 | 14959 |
14961 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 14960 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
14962 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 14961 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
14963 } | 14962 } |
14964 | 14963 |
14965 } } // namespace v8::internal | 14964 } } // namespace v8::internal |
OLD | NEW |