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

Side by Side Diff: src/heap.cc

Issue 7275022: Explicitly pass the closure when allocating a catch or with context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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/heap.h ('k') | src/ia32/full-codegen-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3921 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 Context* context = reinterpret_cast<Context*>(result); 3932 Context* context = reinterpret_cast<Context*>(result);
3933 context->set_map(function_context_map()); 3933 context->set_map(function_context_map());
3934 context->set_closure(function); 3934 context->set_closure(function);
3935 context->set_previous(function->context()); 3935 context->set_previous(function->context());
3936 context->set_extension(NULL); 3936 context->set_extension(NULL);
3937 context->set_global(function->context()->global()); 3937 context->set_global(function->context()->global());
3938 return context; 3938 return context;
3939 } 3939 }
3940 3940
3941 3941
3942 MaybeObject* Heap::AllocateCatchContext(Context* previous, 3942 MaybeObject* Heap::AllocateCatchContext(JSFunction* function,
3943 Context* previous,
3943 String* name, 3944 String* name,
3944 Object* thrown_object) { 3945 Object* thrown_object) {
3945 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); 3946 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX);
3946 Object* result; 3947 Object* result;
3947 { MaybeObject* maybe_result = 3948 { MaybeObject* maybe_result =
3948 AllocateFixedArray(Context::MIN_CONTEXT_SLOTS + 1); 3949 AllocateFixedArray(Context::MIN_CONTEXT_SLOTS + 1);
3949 if (!maybe_result->ToObject(&result)) return maybe_result; 3950 if (!maybe_result->ToObject(&result)) return maybe_result;
3950 } 3951 }
3951 Context* context = reinterpret_cast<Context*>(result); 3952 Context* context = reinterpret_cast<Context*>(result);
3952 context->set_map(catch_context_map()); 3953 context->set_map(catch_context_map());
3953 context->set_closure(previous->closure()); 3954 context->set_closure(function);
3954 context->set_previous(previous); 3955 context->set_previous(previous);
3955 context->set_extension(name); 3956 context->set_extension(name);
3956 context->set_global(previous->global()); 3957 context->set_global(previous->global());
3957 context->set(Context::THROWN_OBJECT_INDEX, thrown_object); 3958 context->set(Context::THROWN_OBJECT_INDEX, thrown_object);
3958 return context; 3959 return context;
3959 } 3960 }
3960 3961
3961 3962
3962 MaybeObject* Heap::AllocateWithContext(Context* previous, 3963 MaybeObject* Heap::AllocateWithContext(JSFunction* function,
3964 Context* previous,
3963 JSObject* extension) { 3965 JSObject* extension) {
3964 Object* result; 3966 Object* result;
3965 { MaybeObject* maybe_result = AllocateFixedArray(Context::MIN_CONTEXT_SLOTS); 3967 { MaybeObject* maybe_result = AllocateFixedArray(Context::MIN_CONTEXT_SLOTS);
3966 if (!maybe_result->ToObject(&result)) return maybe_result; 3968 if (!maybe_result->ToObject(&result)) return maybe_result;
3967 } 3969 }
3968 Context* context = reinterpret_cast<Context*>(result); 3970 Context* context = reinterpret_cast<Context*>(result);
3969 context->set_map(with_context_map()); 3971 context->set_map(with_context_map());
3970 context->set_closure(previous->closure()); 3972 context->set_closure(function);
3971 context->set_previous(previous); 3973 context->set_previous(previous);
3972 context->set_extension(extension); 3974 context->set_extension(extension);
3973 context->set_global(previous->global()); 3975 context->set_global(previous->global());
3974 return context; 3976 return context;
3975 } 3977 }
3976 3978
3977 3979
3978 MaybeObject* Heap::AllocateStruct(InstanceType type) { 3980 MaybeObject* Heap::AllocateStruct(InstanceType type) {
3979 Map* map; 3981 Map* map;
3980 switch (type) { 3982 switch (type) {
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after
6032 } 6034 }
6033 6035
6034 6036
6035 void ExternalStringTable::TearDown() { 6037 void ExternalStringTable::TearDown() {
6036 new_space_strings_.Free(); 6038 new_space_strings_.Free();
6037 old_space_strings_.Free(); 6039 old_space_strings_.Free();
6038 } 6040 }
6039 6041
6040 6042
6041 } } // namespace v8::internal 6043 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698