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

Side by Side Diff: src/mips/stub-cache-mips.cc

Issue 13887004: MIPS: Always check global property cells for readonliness before storing. Add check when the global… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 | « no previous file | no next file » | 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 Register receiver, 403 Register receiver,
404 Register scratch1, 404 Register scratch1,
405 Register scratch2, 405 Register scratch2,
406 Label* miss_label) { 406 Label* miss_label) {
407 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 407 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
408 __ mov(v0, scratch1); 408 __ mov(v0, scratch1);
409 __ Ret(); 409 __ Ret();
410 } 410 }
411 411
412 412
413 // Generate code to check that a global property cell is empty. Create
414 // the property cell at compilation time if no cell exists for the
415 // property.
416 static void GenerateCheckPropertyCell(MacroAssembler* masm,
417 Handle<GlobalObject> global,
418 Handle<Name> name,
419 Register scratch,
420 Label* miss) {
421 Handle<JSGlobalPropertyCell> cell =
422 GlobalObject::EnsurePropertyCell(global, name);
423 ASSERT(cell->value()->IsTheHole());
424 __ li(scratch, Operand(cell));
425 __ lw(scratch,
426 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
427 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
428 __ Branch(miss, ne, scratch, Operand(at));
429 }
430
431
413 // Generate StoreField code, value is passed in a0 register. 432 // Generate StoreField code, value is passed in a0 register.
414 // After executing generated code, the receiver_reg and name_reg 433 // After executing generated code, the receiver_reg and name_reg
415 // may be clobbered. 434 // may be clobbered.
416 void StubCompiler::GenerateStoreField(MacroAssembler* masm, 435 void StubCompiler::GenerateStoreField(MacroAssembler* masm,
417 Handle<JSObject> object, 436 Handle<JSObject> object,
418 LookupResult* lookup, 437 LookupResult* lookup,
419 Handle<Map> transition, 438 Handle<Map> transition,
420 Handle<Name> name, 439 Handle<Name> name,
421 Register receiver_reg, 440 Register receiver_reg,
422 Register name_reg, 441 Register name_reg,
(...skipping 28 matching lines...) Expand all
451 do { 470 do {
452 holder = JSObject::cast(holder->GetPrototype()); 471 holder = JSObject::cast(holder->GetPrototype());
453 } while (holder->GetPrototype()->IsJSObject()); 472 } while (holder->GetPrototype()->IsJSObject());
454 } 473 }
455 Register holder_reg = CheckPrototypes( 474 Register holder_reg = CheckPrototypes(
456 object, receiver_reg, Handle<JSObject>(holder), name_reg, 475 object, receiver_reg, Handle<JSObject>(holder), name_reg,
457 scratch1, scratch2, name, miss_restore_name); 476 scratch1, scratch2, name, miss_restore_name);
458 // If no property was found, and the holder (the last object in the 477 // If no property was found, and the holder (the last object in the
459 // prototype chain) is in slow mode, we need to do a negative lookup on the 478 // prototype chain) is in slow mode, we need to do a negative lookup on the
460 // holder. 479 // holder.
461 if (lookup->holder() == *object && 480 if (lookup->holder() == *object) {
462 !holder->HasFastProperties() && 481 if (holder->IsJSGlobalObject()) {
463 !holder->IsJSGlobalProxy() && 482 GenerateCheckPropertyCell(
464 !holder->IsJSGlobalObject()) { 483 masm,
465 GenerateDictionaryNegativeLookup( 484 Handle<GlobalObject>(GlobalObject::cast(holder)),
466 masm, miss_restore_name, holder_reg, name, scratch1, scratch2); 485 name,
486 scratch1,
487 miss_restore_name);
488 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
489 GenerateDictionaryNegativeLookup(
490 masm, miss_restore_name, holder_reg, name, scratch1, scratch2);
491 }
467 } 492 }
468 } 493 }
469 494
470 // Stub never generated for non-global objects that require access 495 // Stub never generated for non-global objects that require access
471 // checks. 496 // checks.
472 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 497 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
473 498
474 // Perform map transition for the receiver if necessary. 499 // Perform map transition for the receiver if necessary.
475 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) { 500 if (!transition.is_null() && (object->map()->unused_property_fields() == 0)) {
476 // The properties must be extended before we can store the value. 501 // The properties must be extended before we can store the value.
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); 944 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch));
920 } 945 }
921 946
922 StubCompiler* stub_compiler_; 947 StubCompiler* stub_compiler_;
923 const ParameterCount& arguments_; 948 const ParameterCount& arguments_;
924 Register name_; 949 Register name_;
925 Code::ExtraICState extra_ic_state_; 950 Code::ExtraICState extra_ic_state_;
926 }; 951 };
927 952
928 953
929
930 // Generate code to check that a global property cell is empty. Create
931 // the property cell at compilation time if no cell exists for the
932 // property.
933 static void GenerateCheckPropertyCell(MacroAssembler* masm,
934 Handle<GlobalObject> global,
935 Handle<Name> name,
936 Register scratch,
937 Label* miss) {
938 Handle<JSGlobalPropertyCell> cell =
939 GlobalObject::EnsurePropertyCell(global, name);
940 ASSERT(cell->value()->IsTheHole());
941 __ li(scratch, Operand(cell));
942 __ lw(scratch,
943 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
944 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
945 __ Branch(miss, ne, scratch, Operand(at));
946 }
947
948
949 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 954 // Calls GenerateCheckPropertyCell for each global object in the prototype chain
950 // from object to (but not including) holder. 955 // from object to (but not including) holder.
951 static void GenerateCheckPropertyCells(MacroAssembler* masm, 956 static void GenerateCheckPropertyCells(MacroAssembler* masm,
952 Handle<JSObject> object, 957 Handle<JSObject> object,
953 Handle<JSObject> holder, 958 Handle<JSObject> holder,
954 Handle<Name> name, 959 Handle<Name> name,
955 Register scratch, 960 Register scratch,
956 Label* miss) { 961 Label* miss) {
957 Handle<JSObject> current = object; 962 Handle<JSObject> current = object;
958 while (!current.is_identical_to(holder)) { 963 while (!current.is_identical_to(holder)) {
(...skipping 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after
3944 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3949 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3945 } 3950 }
3946 } 3951 }
3947 3952
3948 3953
3949 #undef __ 3954 #undef __
3950 3955
3951 } } // namespace v8::internal 3956 } } // namespace v8::internal
3952 3957
3953 #endif // V8_TARGET_ARCH_MIPS 3958 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698