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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 // JavaScript builtins, we return uninitialized as the state to | 326 // JavaScript builtins, we return uninitialized as the state to |
327 // force the inline cache back to monomorphic state. | 327 // force the inline cache back to monomorphic state. |
328 if (receiver->IsJSBuiltinsObject()) state_ = UNINITIALIZED; | 328 if (receiver->IsJSBuiltinsObject()) state_ = UNINITIALIZED; |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 MaybeHandle<Object> IC::TypeError(const char* type, Handle<Object> object, | 332 MaybeHandle<Object> IC::TypeError(const char* type, Handle<Object> object, |
333 Handle<Object> key) { | 333 Handle<Object> key) { |
334 HandleScope scope(isolate()); | 334 HandleScope scope(isolate()); |
335 Handle<Object> args[2] = {key, object}; | 335 Handle<Object> args[2] = {key, object}; |
336 Handle<Object> error = | 336 THROW_NEW_ERROR(isolate(), NewTypeError(type, HandleVector(args, 2)), Object); |
337 isolate()->factory()->NewTypeError(type, HandleVector(args, 2)); | |
338 return isolate()->Throw<Object>(error); | |
339 } | 337 } |
340 | 338 |
341 | 339 |
342 MaybeHandle<Object> IC::ReferenceError(const char* type, Handle<Name> name) { | 340 MaybeHandle<Object> IC::ReferenceError(const char* type, Handle<Name> name) { |
343 HandleScope scope(isolate()); | 341 HandleScope scope(isolate()); |
344 Handle<Object> error = | 342 THROW_NEW_ERROR(isolate(), NewReferenceError(type, HandleVector(&name, 1)), |
345 isolate()->factory()->NewReferenceError(type, HandleVector(&name, 1)); | 343 Object); |
346 return isolate()->Throw<Object>(error); | |
347 } | 344 } |
348 | 345 |
349 | 346 |
350 static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state, | 347 static void ComputeTypeInfoCountDelta(IC::State old_state, IC::State new_state, |
351 int* polymorphic_delta, | 348 int* polymorphic_delta, |
352 int* generic_delta) { | 349 int* generic_delta) { |
353 switch (old_state) { | 350 switch (old_state) { |
354 case UNINITIALIZED: | 351 case UNINITIALIZED: |
355 case PREMONOMORPHIC: | 352 case PREMONOMORPHIC: |
356 if (new_state == UNINITIALIZED || new_state == PREMONOMORPHIC) break; | 353 if (new_state == UNINITIALIZED || new_state == PREMONOMORPHIC) break; |
(...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 // If the load is non-contextual, just return the undefined result. | 3106 // If the load is non-contextual, just return the undefined result. |
3110 // Note that both keyed and non-keyed loads may end up here. | 3107 // Note that both keyed and non-keyed loads may end up here. |
3111 HandleScope scope(isolate); | 3108 HandleScope scope(isolate); |
3112 LoadIC ic(IC::NO_EXTRA_FRAME, isolate); | 3109 LoadIC ic(IC::NO_EXTRA_FRAME, isolate); |
3113 if (ic.contextual_mode() != CONTEXTUAL) { | 3110 if (ic.contextual_mode() != CONTEXTUAL) { |
3114 return isolate->heap()->undefined_value(); | 3111 return isolate->heap()->undefined_value(); |
3115 } | 3112 } |
3116 | 3113 |
3117 // Throw a reference error. | 3114 // Throw a reference error. |
3118 Handle<Name> name_handle(name); | 3115 Handle<Name> name_handle(name); |
3119 Handle<Object> error = isolate->factory()->NewReferenceError( | 3116 THROW_NEW_ERROR_RETURN_FAILURE( |
3120 "not_defined", HandleVector(&name_handle, 1)); | 3117 isolate, NewReferenceError("not_defined", HandleVector(&name_handle, 1))); |
3121 return isolate->Throw(*error); | |
3122 } | 3118 } |
3123 | 3119 |
3124 | 3120 |
3125 /** | 3121 /** |
3126 * Loads a property with an interceptor performing post interceptor | 3122 * Loads a property with an interceptor performing post interceptor |
3127 * lookup if interceptor failed. | 3123 * lookup if interceptor failed. |
3128 */ | 3124 */ |
3129 RUNTIME_FUNCTION(LoadPropertyWithInterceptor) { | 3125 RUNTIME_FUNCTION(LoadPropertyWithInterceptor) { |
3130 HandleScope scope(isolate); | 3126 HandleScope scope(isolate); |
3131 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); | 3127 DCHECK(args.length() == NamedLoadHandlerCompiler::kInterceptorArgsLength); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 static const Address IC_utilities[] = { | 3200 static const Address IC_utilities[] = { |
3205 #define ADDR(name) FUNCTION_ADDR(name), | 3201 #define ADDR(name) FUNCTION_ADDR(name), |
3206 IC_UTIL_LIST(ADDR) NULL | 3202 IC_UTIL_LIST(ADDR) NULL |
3207 #undef ADDR | 3203 #undef ADDR |
3208 }; | 3204 }; |
3209 | 3205 |
3210 | 3206 |
3211 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3207 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
3212 } | 3208 } |
3213 } // namespace v8::internal | 3209 } // namespace v8::internal |
OLD | NEW |