Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: src/objects.cc

Issue 2576003: First phase of migration to new named property query callbacks. (Closed)
Patch Set: Better version Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 AssertNoContextChange ncc; 2006 AssertNoContextChange ncc;
2007 2007
2008 HandleScope scope; 2008 HandleScope scope;
2009 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 2009 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
2010 Handle<JSObject> receiver_handle(receiver); 2010 Handle<JSObject> receiver_handle(receiver);
2011 Handle<JSObject> holder_handle(this); 2011 Handle<JSObject> holder_handle(this);
2012 Handle<String> name_handle(name); 2012 Handle<String> name_handle(name);
2013 CustomArguments args(interceptor->data(), receiver, this); 2013 CustomArguments args(interceptor->data(), receiver, this);
2014 v8::AccessorInfo info(args.end()); 2014 v8::AccessorInfo info(args.end());
2015 if (!interceptor->query()->IsUndefined()) { 2015 if (!interceptor->query()->IsUndefined()) {
2016 v8::NamedPropertyQuery query = 2016 v8::NamedPropertyQueryImpl query =
2017 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query()); 2017 v8::ToCData<v8::NamedPropertyQueryImpl>(interceptor->query());
2018 LOG(ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); 2018 LOG(ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name));
2019 v8::Handle<v8::Boolean> result; 2019 v8::Handle<v8::Value> result;
2020 { 2020 {
2021 // Leaving JavaScript. 2021 // Leaving JavaScript.
2022 VMState state(EXTERNAL); 2022 VMState state(EXTERNAL);
2023 result = query(v8::Utils::ToLocal(name_handle), info); 2023 result = query(v8::Utils::ToLocal(name_handle), info);
2024 } 2024 }
2025 if (!result.IsEmpty()) { 2025 if (!result.IsEmpty()) {
2026 // Convert the boolean result to a property attribute 2026 // Temporary complicated logic, would be removed soon.
2027 // specification. 2027 if (result->IsBoolean()) {
2028 return result->IsTrue() ? NONE : ABSENT; 2028 // Convert the boolean result to a property attribute
2029 // specification.
2030 return result->IsTrue() ? NONE : ABSENT;
2031 } else {
2032 ASSERT(result->IsInt32());
2033 return static_cast<PropertyAttributes>(result->Int32Value());
2034 }
2029 } 2035 }
2030 } else if (!interceptor->getter()->IsUndefined()) { 2036 } else if (!interceptor->getter()->IsUndefined()) {
2031 v8::NamedPropertyGetter getter = 2037 v8::NamedPropertyGetter getter =
2032 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 2038 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
2033 LOG(ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); 2039 LOG(ApiNamedPropertyAccess("interceptor-named-get-has", this, name));
2034 v8::Handle<v8::Value> result; 2040 v8::Handle<v8::Value> result;
2035 { 2041 {
2036 // Leaving JavaScript. 2042 // Leaving JavaScript.
2037 VMState state(EXTERNAL); 2043 VMState state(EXTERNAL);
2038 result = getter(v8::Utils::ToLocal(name_handle), info); 2044 result = getter(v8::Utils::ToLocal(name_handle), info);
(...skipping 6669 matching lines...) Expand 10 before | Expand all | Expand 10 after
8708 if (break_point_objects()->IsUndefined()) return 0; 8714 if (break_point_objects()->IsUndefined()) return 0;
8709 // Single beak point. 8715 // Single beak point.
8710 if (!break_point_objects()->IsFixedArray()) return 1; 8716 if (!break_point_objects()->IsFixedArray()) return 1;
8711 // Multiple break points. 8717 // Multiple break points.
8712 return FixedArray::cast(break_point_objects())->length(); 8718 return FixedArray::cast(break_point_objects())->length();
8713 } 8719 }
8714 #endif 8720 #endif
8715 8721
8716 8722
8717 } } // namespace v8::internal 8723 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698