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

Side by Side Diff: src/runtime.cc

Issue 18067: Fix issue 6264 with a test case.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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 | 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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } else { 336 } else {
337 RUNTIME_ASSERT(offset < ObjectTemplateInfo::kSize); 337 RUNTIME_ASSERT(offset < ObjectTemplateInfo::kSize);
338 } 338 }
339 return *HeapObject::RawField(templ, offset); 339 return *HeapObject::RawField(templ, offset);
340 } 340 }
341 341
342 342
343 static Object* Runtime_DisableAccessChecks(Arguments args) { 343 static Object* Runtime_DisableAccessChecks(Arguments args) {
344 ASSERT(args.length() == 1); 344 ASSERT(args.length() == 1);
345 CONVERT_CHECKED(HeapObject, object, args[0]); 345 CONVERT_CHECKED(HeapObject, object, args[0]);
346 bool needs_access_checks = object->map()->is_access_check_needed(); 346 Map* old_map = object->map();
347 object->map()->set_is_access_check_needed(false); 347 bool needs_access_checks = old_map->is_access_check_needed();
348 if (needs_access_checks) {
349 // Copy map so it won't interfere constructor's initial map.
350 Object* new_map = old_map->CopyDropTransitions();
351 if (new_map->IsFailure()) return new_map;
352
353 Map::cast(new_map)->set_is_access_check_needed(false);
354 object->set_map(Map::cast(new_map));
355 }
348 return needs_access_checks ? Heap::true_value() : Heap::false_value(); 356 return needs_access_checks ? Heap::true_value() : Heap::false_value();
349 } 357 }
350 358
351 359
352 static Object* Runtime_EnableAccessChecks(Arguments args) { 360 static Object* Runtime_EnableAccessChecks(Arguments args) {
353 ASSERT(args.length() == 1); 361 ASSERT(args.length() == 1);
354 CONVERT_CHECKED(HeapObject, object, args[0]); 362 CONVERT_CHECKED(HeapObject, object, args[0]);
355 object->map()->set_is_access_check_needed(true); 363 Map* old_map = object->map();
364 if (!old_map->is_access_check_needed()) {
365 // Copy map so it won't interfere constructor's initial map.
366 Object* new_map = old_map->CopyDropTransitions();
367 if (new_map->IsFailure()) return new_map;
368
369 Map::cast(new_map)->set_is_access_check_needed(true);
370 object->set_map(Map::cast(new_map));
371 }
356 return Heap::undefined_value(); 372 return Heap::undefined_value();
357 } 373 }
358 374
359 375
360 static Object* ThrowRedeclarationError(const char* type, Handle<String> name) { 376 static Object* ThrowRedeclarationError(const char* type, Handle<String> name) {
361 HandleScope scope; 377 HandleScope scope;
362 Handle<Object> type_handle = Factory::NewStringFromAscii(CStrVector(type)); 378 Handle<Object> type_handle = Factory::NewStringFromAscii(CStrVector(type));
363 Handle<Object> args[2] = { type_handle, name }; 379 Handle<Object> args[2] = { type_handle, name };
364 Handle<Object> error = 380 Handle<Object> error =
365 Factory::NewTypeError("redeclaration", HandleVector(args, 2)); 381 Factory::NewTypeError("redeclaration", HandleVector(args, 2));
(...skipping 5562 matching lines...) Expand 10 before | Expand all | Expand 10 after
5928 } else { 5944 } else {
5929 // Handle last resort GC and make sure to allow future allocations 5945 // Handle last resort GC and make sure to allow future allocations
5930 // to grow the heap without causing GCs (if possible). 5946 // to grow the heap without causing GCs (if possible).
5931 Counters::gc_last_resort_from_js.Increment(); 5947 Counters::gc_last_resort_from_js.Increment();
5932 Heap::CollectAllGarbage(); 5948 Heap::CollectAllGarbage();
5933 } 5949 }
5934 } 5950 }
5935 5951
5936 5952
5937 } } // namespace v8::internal 5953 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698