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

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 942963004: Remove internal use of v8::AccessType, always pass v8::ACCESS_HAS instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove the distinction between named/indexed access checks, always pass "undefined" as "name" Created 5 years, 10 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/objects.cc ('k') | src/runtime/runtime-object.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 Handle<String> source(String::cast(Handle<Script>::cast(script)->source())); 217 Handle<String> source(String::cast(Handle<Script>::cast(script)->source()));
218 return *isolate->factory()->NewSubString( 218 return *isolate->factory()->NewSubString(
219 source, Handle<Smi>::cast(start_position)->value(), 219 source, Handle<Smi>::cast(start_position)->value(),
220 Handle<Smi>::cast(end_position)->value()); 220 Handle<Smi>::cast(end_position)->value());
221 } 221 }
222 222
223 223
224 static Object* LoadFromSuper(Isolate* isolate, Handle<Object> receiver, 224 static Object* LoadFromSuper(Isolate* isolate, Handle<Object> receiver,
225 Handle<JSObject> home_object, Handle<Name> name) { 225 Handle<JSObject> home_object, Handle<Name> name) {
226 if (home_object->IsAccessCheckNeeded() && 226 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) {
227 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_GET)) { 227 isolate->ReportFailedAccessCheck(home_object);
228 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET);
229 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 228 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
230 } 229 }
231 230
232 PrototypeIterator iter(isolate, home_object); 231 PrototypeIterator iter(isolate, home_object);
233 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 232 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
234 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 233 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
235 234
236 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 235 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
237 Handle<Object> result; 236 Handle<Object> result;
238 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it)); 237 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it));
239 return *result; 238 return *result;
240 } 239 }
241 240
242 241
243 static Object* LoadElementFromSuper(Isolate* isolate, Handle<Object> receiver, 242 static Object* LoadElementFromSuper(Isolate* isolate, Handle<Object> receiver,
244 Handle<JSObject> home_object, 243 Handle<JSObject> home_object,
245 uint32_t index) { 244 uint32_t index) {
246 if (home_object->IsAccessCheckNeeded() && 245 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) {
247 !isolate->MayIndexedAccess(home_object, index, v8::ACCESS_GET)) { 246 isolate->ReportFailedAccessCheck(home_object);
248 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_GET);
249 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 247 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
250 } 248 }
251 249
252 PrototypeIterator iter(isolate, home_object); 250 PrototypeIterator iter(isolate, home_object);
253 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 251 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
254 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 252 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
255 253
256 Handle<Object> result; 254 Handle<Object> result;
257 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 255 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
258 isolate, result, 256 isolate, result,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (name->AsArrayIndex(&index)) { 288 if (name->AsArrayIndex(&index)) {
291 return LoadElementFromSuper(isolate, receiver, home_object, index); 289 return LoadElementFromSuper(isolate, receiver, home_object, index);
292 } 290 }
293 return LoadFromSuper(isolate, receiver, home_object, name); 291 return LoadFromSuper(isolate, receiver, home_object, name);
294 } 292 }
295 293
296 294
297 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object, 295 static Object* StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
298 Handle<Object> receiver, Handle<Name> name, 296 Handle<Object> receiver, Handle<Name> name,
299 Handle<Object> value, LanguageMode language_mode) { 297 Handle<Object> value, LanguageMode language_mode) {
300 if (home_object->IsAccessCheckNeeded() && 298 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) {
301 !isolate->MayNamedAccess(home_object, name, v8::ACCESS_SET)) { 299 isolate->ReportFailedAccessCheck(home_object);
302 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
303 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 300 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
304 } 301 }
305 302
306 PrototypeIterator iter(isolate, home_object); 303 PrototypeIterator iter(isolate, home_object);
307 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 304 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
308 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 305 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
309 306
310 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto)); 307 LookupIterator it(receiver, name, Handle<JSReceiver>::cast(proto));
311 Handle<Object> result; 308 Handle<Object> result;
312 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 309 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
313 isolate, result, 310 isolate, result,
314 Object::SetSuperProperty(&it, value, language_mode, 311 Object::SetSuperProperty(&it, value, language_mode,
315 Object::CERTAINLY_NOT_STORE_FROM_KEYED)); 312 Object::CERTAINLY_NOT_STORE_FROM_KEYED));
316 return *result; 313 return *result;
317 } 314 }
318 315
319 316
320 static Object* StoreElementToSuper(Isolate* isolate, 317 static Object* StoreElementToSuper(Isolate* isolate,
321 Handle<JSObject> home_object, 318 Handle<JSObject> home_object,
322 Handle<Object> receiver, uint32_t index, 319 Handle<Object> receiver, uint32_t index,
323 Handle<Object> value, 320 Handle<Object> value,
324 LanguageMode language_mode) { 321 LanguageMode language_mode) {
325 if (home_object->IsAccessCheckNeeded() && 322 if (home_object->IsAccessCheckNeeded() && !isolate->MayAccess(home_object)) {
326 !isolate->MayIndexedAccess(home_object, index, v8::ACCESS_SET)) { 323 isolate->ReportFailedAccessCheck(home_object);
327 isolate->ReportFailedAccessCheck(home_object, v8::ACCESS_SET);
328 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 324 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
329 } 325 }
330 326
331 PrototypeIterator iter(isolate, home_object); 327 PrototypeIterator iter(isolate, home_object);
332 Handle<Object> proto = PrototypeIterator::GetCurrent(iter); 328 Handle<Object> proto = PrototypeIterator::GetCurrent(iter);
333 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value(); 329 if (!proto->IsJSReceiver()) return isolate->heap()->undefined_value();
334 330
335 Handle<Object> result; 331 Handle<Object> result;
336 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 332 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
337 isolate, result, 333 isolate, result,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return *isolate->factory()->undefined_value(); 419 return *isolate->factory()->undefined_value();
424 } 420 }
425 421
426 422
427 RUNTIME_FUNCTION(RuntimeReference_DefaultConstructorCallSuper) { 423 RUNTIME_FUNCTION(RuntimeReference_DefaultConstructorCallSuper) {
428 UNREACHABLE(); 424 UNREACHABLE();
429 return nullptr; 425 return nullptr;
430 } 426 }
431 } 427 }
432 } // namespace v8::internal 428 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698