OLD | NEW |
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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 ASSERT(args.length() == 4); | 1225 ASSERT(args.length() == 4); |
1226 | 1226 |
1227 CONVERT_ARG_CHECKED(Context, context, 0); | 1227 CONVERT_ARG_CHECKED(Context, context, 0); |
1228 Handle<String> name(String::cast(args[1])); | 1228 Handle<String> name(String::cast(args[1])); |
1229 PropertyAttributes mode = static_cast<PropertyAttributes>(args.smi_at(2)); | 1229 PropertyAttributes mode = static_cast<PropertyAttributes>(args.smi_at(2)); |
1230 RUNTIME_ASSERT(mode == READ_ONLY || mode == NONE); | 1230 RUNTIME_ASSERT(mode == READ_ONLY || mode == NONE); |
1231 Handle<Object> initial_value(args[3], isolate); | 1231 Handle<Object> initial_value(args[3], isolate); |
1232 | 1232 |
1233 // Declarations are always done in the function context. | 1233 // Declarations are always done in the function context. |
1234 context = Handle<Context>(context->fcontext()); | 1234 context = Handle<Context>(context->fcontext()); |
1235 ASSERT(context->IsFunctionContext()); | 1235 ASSERT(context->IsFunctionContext() || context->IsGlobalContext()); |
1236 | 1236 |
1237 int index; | 1237 int index; |
1238 PropertyAttributes attributes; | 1238 PropertyAttributes attributes; |
1239 ContextLookupFlags flags = DONT_FOLLOW_CHAINS; | 1239 ContextLookupFlags flags = DONT_FOLLOW_CHAINS; |
1240 Handle<Object> holder = | 1240 Handle<Object> holder = |
1241 context->Lookup(name, flags, &index, &attributes); | 1241 context->Lookup(name, flags, &index, &attributes); |
1242 | 1242 |
1243 if (attributes != ABSENT) { | 1243 if (attributes != ABSENT) { |
1244 // The name was declared before; check for conflicting | 1244 // The name was declared before; check for conflicting |
1245 // re-declarations: This is similar to the code in parser.cc in | 1245 // re-declarations: This is similar to the code in parser.cc in |
(...skipping 11095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12341 } else { | 12341 } else { |
12342 // Handle last resort GC and make sure to allow future allocations | 12342 // Handle last resort GC and make sure to allow future allocations |
12343 // to grow the heap without causing GCs (if possible). | 12343 // to grow the heap without causing GCs (if possible). |
12344 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12344 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12345 isolate->heap()->CollectAllGarbage(false); | 12345 isolate->heap()->CollectAllGarbage(false); |
12346 } | 12346 } |
12347 } | 12347 } |
12348 | 12348 |
12349 | 12349 |
12350 } } // namespace v8::internal | 12350 } } // namespace v8::internal |
OLD | NEW |