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

Side by Side Diff: src/heap.cc

Issue 14834: Fixing a subtle bug in receiver resolution when a thrown and caught function ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years 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/heap.h ('k') | src/objects.h » ('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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); 1010 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize);
1011 if (obj->IsFailure()) return false; 1011 if (obj->IsFailure()) return false;
1012 hash_table_map_ = Map::cast(obj); 1012 hash_table_map_ = Map::cast(obj);
1013 1013
1014 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); 1014 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize);
1015 if (obj->IsFailure()) return false; 1015 if (obj->IsFailure()) return false;
1016 context_map_ = Map::cast(obj); 1016 context_map_ = Map::cast(obj);
1017 1017
1018 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize); 1018 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize);
1019 if (obj->IsFailure()) return false; 1019 if (obj->IsFailure()) return false;
1020 catch_context_map_ = Map::cast(obj);
1021
1022 obj = AllocateMap(FIXED_ARRAY_TYPE, HeapObject::kHeaderSize);
1023 if (obj->IsFailure()) return false;
1020 global_context_map_ = Map::cast(obj); 1024 global_context_map_ = Map::cast(obj);
1021 1025
1022 obj = AllocateMap(JS_FUNCTION_TYPE, JSFunction::kSize); 1026 obj = AllocateMap(JS_FUNCTION_TYPE, JSFunction::kSize);
1023 if (obj->IsFailure()) return false; 1027 if (obj->IsFailure()) return false;
1024 boilerplate_function_map_ = Map::cast(obj); 1028 boilerplate_function_map_ = Map::cast(obj);
1025 1029
1026 obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, SharedFunctionInfo::kSize); 1030 obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, SharedFunctionInfo::kSize);
1027 if (obj->IsFailure()) return false; 1031 if (obj->IsFailure()) return false;
1028 shared_function_info_map_ = Map::cast(obj); 1032 shared_function_info_map_ = Map::cast(obj);
1029 1033
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 context->set_previous(NULL); 2384 context->set_previous(NULL);
2381 context->set_extension(NULL); 2385 context->set_extension(NULL);
2382 context->set_global(function->context()->global()); 2386 context->set_global(function->context()->global());
2383 ASSERT(!context->IsGlobalContext()); 2387 ASSERT(!context->IsGlobalContext());
2384 ASSERT(context->is_function_context()); 2388 ASSERT(context->is_function_context());
2385 ASSERT(result->IsContext()); 2389 ASSERT(result->IsContext());
2386 return result; 2390 return result;
2387 } 2391 }
2388 2392
2389 2393
2390 Object* Heap::AllocateWithContext(Context* previous, JSObject* extension) { 2394 Object* Heap::AllocateWithContext(Context* previous,
2395 JSObject* extension,
2396 bool is_catch_context) {
2391 Object* result = Heap::AllocateFixedArray(Context::MIN_CONTEXT_SLOTS); 2397 Object* result = Heap::AllocateFixedArray(Context::MIN_CONTEXT_SLOTS);
2392 if (result->IsFailure()) return result; 2398 if (result->IsFailure()) return result;
2393 Context* context = reinterpret_cast<Context*>(result); 2399 Context* context = reinterpret_cast<Context*>(result);
2394 context->set_map(context_map()); 2400 context->set_map(is_catch_context ? catch_context_map() : context_map());
2395 context->set_closure(previous->closure()); 2401 context->set_closure(previous->closure());
2396 context->set_fcontext(previous->fcontext()); 2402 context->set_fcontext(previous->fcontext());
2397 context->set_previous(previous); 2403 context->set_previous(previous);
2398 context->set_extension(extension); 2404 context->set_extension(extension);
2399 context->set_global(previous->global()); 2405 context->set_global(previous->global());
2400 ASSERT(!context->IsGlobalContext()); 2406 ASSERT(!context->IsGlobalContext());
2401 ASSERT(!context->is_function_context()); 2407 ASSERT(!context->is_function_context());
2402 ASSERT(result->IsContext()); 2408 ASSERT(result->IsContext());
2403 return result; 2409 return result;
2404 } 2410 }
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
3349 #ifdef DEBUG 3355 #ifdef DEBUG
3350 bool Heap::GarbageCollectionGreedyCheck() { 3356 bool Heap::GarbageCollectionGreedyCheck() {
3351 ASSERT(FLAG_gc_greedy); 3357 ASSERT(FLAG_gc_greedy);
3352 if (Bootstrapper::IsActive()) return true; 3358 if (Bootstrapper::IsActive()) return true;
3353 if (disallow_allocation_failure()) return true; 3359 if (disallow_allocation_failure()) return true;
3354 return CollectGarbage(0, NEW_SPACE); 3360 return CollectGarbage(0, NEW_SPACE);
3355 } 3361 }
3356 #endif 3362 #endif
3357 3363
3358 } } // namespace v8::internal 3364 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698