Avoid sign extension in packed-switch.

This code (at least in the ARM version) is trying to assign to r0 and r1
from C by returning a 64-bit result. The mistaken use of signed integers
for pointers can lead to sign extension if the JIT code cache is at a
sufficiently high address.

Bug: 6799823
Bug: 6703991

(cherry picked from commit 2d0c1c2dbe44458ebb199c47ce1047f266db5349)

Conflicts:

	vm/compiler/codegen/mips/CalloutHelper.h
	vm/compiler/codegen/mips/CodegenDriver.cpp

Change-Id: Id4699fdd0b3d61abe9c92874832b8561df4fa797
merge in jb-release history after reset to jb-dev
merge in jb-release history after reset to jb-dev
Upgrade to dlmalloc 2.8.5.

Switch to using dlmalloc 2.8.5. Define mspace functionality directly
using dlmalloc rather than taking from libcutils.
Remove growth limit check in tryMalloc that only checks initial growth
limit.
Implement trimming at the end of the mspace.

Depends upon: https://android-review.googlesource.com/41717

Change-Id: Ia2c6b50bdb0b0d5aae4b18deefbd1bf50dfa49d5
Trim pre-Zygote fork, fix under-estimate of heap limit.

Card scanning uses dvmHeapSourceGetValue to scan from the heap base to
the total foot print of the heap. Trimming the Zygote may lower the
footprint of the heap by creating a hole in the middle. This hole is
unaccounted for in the card scanning leading to missed dirty cards.

This was a regression introduced by:
https://android-review.googlesource.com/#/c/41728/
as it didn't #define MORECORE_CANNOT_TRIM 1 that was previously defined
here:
https://android-review.googlesource.com/#/c/41731/4/libcutils/mspace.c

Introduce a notion of dvmHeapSourceGetLimit so that card scanning
doesn't rely on footprint. Trim the heap before forking the Zygote. This
change continues to enable morecore trimming of mspaces.

Change-Id: I3f0b12371097f50a1f920cac25846ca08685e7ed
Optimize those StrictMath routines that are identical to Math routines.

We can just use the existing Math intinsics.

Bug: 7146208
Change-Id: I9e78d33cf65a5dcc5a7c0133e67bd9c3c1e43f23
Revert "Upgrade to dlmalloc 2.8.5."

These changes to malloc were breaking some blobs... :(

This reverts commit 9cee9219e4477e9a0a6fd72c7c90828d141d25e1.

Revert "Trim pre-Zygote fork, fix under-estimate of heap limit."

This reverts commit d87884d814400b03d1fd6f6370dddae080522dae.
Merge branch 'jb-release' of https://android.googlesource.com/platform/dalvik into aosp
Fix an ugly bug where try/catch offsets weren't being mapped properly.

In dex files, there are several places where one object refers
to another object by its position in the file. The dex merger
is generally very careful to adjust these mappings when combining
dex files.

Unfortunately one of these cases was broken. Each try_item refers
to a corresponding encoded_catch_handler by its byte offset in a
list. Most of the time this byte offset is the same in the input
dex file and the output dex file. But encoded_catch_handlers are
variable-length because they use a variable-length uleb128 encoding
to address the type_idx being caught. When dex files are merged,
some exception types may go from having a small index to having
a large index, increasing the number of bytes required to encode
that index. This breaks our ability to directly copy over offsets
as we were doing previously.

Bug: http://code.google.com/p/android/issues/detail?id=36490
Change-Id: I3bdadf20899fdb5d4d074e69103b33c0404a31f8
Merge remote branch 'cyanogen/jellybean' into jellybean

* cyanogen/jellybean:
  Fix an ugly bug where try/catch offsets weren't being mapped properly.
  Revert "Upgrade to dlmalloc 2.8.5."
  Optimize those StrictMath routines that are identical to Math routines.
  Trim pre-Zygote fork, fix under-estimate of heap limit.
  Upgrade to dlmalloc 2.8.5.
  Avoid sign extension in packed-switch.