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

Side by Side Diff: src/objects.cc

Issue 10831388: Handle native callbacks without getters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed elements case, too. Rebased. Created 8 years, 4 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 | Annotate | Revision Log
« 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 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 Handle<Object> receiver_handle(receiver); 183 Handle<Object> receiver_handle(receiver);
184 Handle<Object> args[2] = { name_handle, receiver_handle }; 184 Handle<Object> args[2] = { name_handle, receiver_handle };
185 Handle<Object> error = 185 Handle<Object> error =
186 isolate->factory()->NewTypeError("incompatible_method_receiver", 186 isolate->factory()->NewTypeError("incompatible_method_receiver",
187 HandleVector(args, 187 HandleVector(args,
188 ARRAY_SIZE(args))); 188 ARRAY_SIZE(args)));
189 return isolate->Throw(*error); 189 return isolate->Throw(*error);
190 } 190 }
191 Object* fun_obj = data->getter(); 191 Object* fun_obj = data->getter();
192 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 192 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
193 if (call_fun == NULL) return isolate->heap()->undefined_value();
193 HandleScope scope(isolate); 194 HandleScope scope(isolate);
194 JSObject* self = JSObject::cast(receiver); 195 JSObject* self = JSObject::cast(receiver);
195 Handle<String> key(name); 196 Handle<String> key(name);
196 LOG(isolate, ApiNamedPropertyAccess("load", self, name)); 197 LOG(isolate, ApiNamedPropertyAccess("load", self, name));
197 CustomArguments args(isolate, data->data(), self, this); 198 CustomArguments args(isolate, data->data(), self, this);
198 v8::AccessorInfo info(args.end()); 199 v8::AccessorInfo info(args.end());
199 v8::Handle<v8::Value> result; 200 v8::Handle<v8::Value> result;
200 { 201 {
201 // Leaving JavaScript. 202 // Leaving JavaScript.
202 VMState state(isolate, EXTERNAL); 203 VMState state(isolate, EXTERNAL);
(...skipping 8919 matching lines...) Expand 10 before | Expand all | Expand 10 after
9122 uint32_t index, 9123 uint32_t index,
9123 Object* holder) { 9124 Object* holder) {
9124 Isolate* isolate = GetIsolate(); 9125 Isolate* isolate = GetIsolate();
9125 ASSERT(!structure->IsForeign()); 9126 ASSERT(!structure->IsForeign());
9126 9127
9127 // api style callbacks. 9128 // api style callbacks.
9128 if (structure->IsAccessorInfo()) { 9129 if (structure->IsAccessorInfo()) {
9129 Handle<AccessorInfo> data(AccessorInfo::cast(structure)); 9130 Handle<AccessorInfo> data(AccessorInfo::cast(structure));
9130 Object* fun_obj = data->getter(); 9131 Object* fun_obj = data->getter();
9131 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 9132 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
9133 if (call_fun == NULL) return isolate->heap()->undefined_value();
9132 HandleScope scope(isolate); 9134 HandleScope scope(isolate);
9133 Handle<JSObject> self(JSObject::cast(receiver)); 9135 Handle<JSObject> self(JSObject::cast(receiver));
9134 Handle<JSObject> holder_handle(JSObject::cast(holder)); 9136 Handle<JSObject> holder_handle(JSObject::cast(holder));
9135 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 9137 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
9136 Handle<String> key = isolate->factory()->NumberToString(number); 9138 Handle<String> key = isolate->factory()->NumberToString(number);
9137 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); 9139 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key));
9138 CustomArguments args(isolate, data->data(), *self, *holder_handle); 9140 CustomArguments args(isolate, data->data(), *self, *holder_handle);
9139 v8::AccessorInfo info(args.end()); 9141 v8::AccessorInfo info(args.end());
9140 v8::Handle<v8::Value> result; 9142 v8::Handle<v8::Value> result;
9141 { 9143 {
(...skipping 4023 matching lines...) Expand 10 before | Expand all | Expand 10 after
13165 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13167 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13166 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13168 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13167 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13169 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13168 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13170 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13169 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13171 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13170 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13172 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13171 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13173 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13172 } 13174 }
13173 13175
13174 } } // namespace v8::internal 13176 } } // 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